diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-12-23 00:54:27 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-12-23 00:54:27 +0200 |
commit | 0077bc419d34a0341f978fc0e2d5cba8d35d4b28 (patch) | |
tree | f5cb831a306e99dce9a8c5af1b4be55cf7dbb658 /src/watcher.c | |
parent | 67a64a6a7809c183516740696e15ab88f82d7ef0 (diff) | |
download | wydawca-0077bc419d34a0341f978fc0e2d5cba8d35d4b28.tar.gz wydawca-0077bc419d34a0341f978fc0e2d5cba8d35d4b28.tar.bz2 |
Fix memory leaks, provide config statements for disabling inotify.
* src/config.c: New statement "inotify" (global and
spool-specific).
* src/gpg.c (gpg_verify_signature): Free key when
no longer needed.
(verify_directive_signature): Fix memory leak.
* src/job.c (job_queue_runner): Free the unlinked job.
* src/triplet.c (triplet_lookup): Free key.name.
* src/verify.c (fill_project_name): Return immediately if
trp->blurb is not null.
* src/watcher.c (create_watcher): Ignore spool if its
inotify_enable is false.
(watcher_init): Return immediately if inotify_enable is
false.
* src/wydawca.c (inotify_enable): New global.
* src/wydawca.h: Likewise.
Diffstat (limited to 'src/watcher.c')
-rw-r--r-- | src/watcher.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/watcher.c b/src/watcher.c index f8761ee..c52e3e6 100644 --- a/src/watcher.c +++ b/src/watcher.c @@ -84,8 +84,15 @@ create_watcher (struct spool *sp, void *data) if (!sp) return 0; + if (!sp->inotify_enable) + { + if (debug_level > 1) + logmsg (LOG_DEBUG, "disabling inotify support for spool %s", sp->tag); + return 0; + } + if (debug_level > 1) - logmsg (LOG_DEBUG, "creating watcher %s", path); + logmsg (LOG_DEBUG, "spool %s: creating watcher %s", sp->tag, path); dwp = malloc (sizeof(*dwp)); if (!dwp) { @@ -114,6 +121,13 @@ watcher_init () { int ifd, rc; + if (!inotify_enable) + { + if (debug_level > 1) + logmsg (LOG_DEBUG, "disabling inotify support"); + return -1; + } + if (debug_level > 1) logmsg (LOG_DEBUG, "setting up inotify"); ifd = inotify_init (); |