summaryrefslogtreecommitdiffstats
path: root/common/sysutils.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-10-15 21:35:05 +0200
committerWerner Koch <wk@gnupg.org>2016-10-15 21:35:05 +0200
commit2f7d4c38c9e7bcc14e6e0bf219d688c40a4afecb (patch)
tree5b8d91c526f29c50a24c17492dc807ad9f3ee6f4 /common/sysutils.h
parentdirmngr: use gnupg_mkdtemp instead of mkstemp (diff)
downloadgnupg2-2f7d4c38c9e7bcc14e6e0bf219d688c40a4afecb.tar.xz
gnupg2-2f7d4c38c9e7bcc14e6e0bf219d688c40a4afecb.zip
agent: Move inotify code to common and improve it.
* common/sysutils.c: Include sys/inotify.h. (my_error_from_syserror, my_error): New. (gnupg_inotify_watch_socket): New. (gnupg_inotify_has_name): New. * agent/gpg-agent.c: Do not include sys/inotify.h. (my_inotify_is_name): Remove. (handle_connections): Remove HAVE_INOTIFY_INIT protected code and use the new functions. -- When removing not a simple socket file but the entire directory the old code missed most events and thus did not worked properly. IN_DELETE_SELF has also been added to the watch list to detect a removal of the directory. However, in all tests that event was not triggered. The only way it could be triggered was by not watching the socket dir but an arbitary directory and rmdir that. GnuPG-bug-id: 2756 Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'common/sysutils.h')
-rw-r--r--common/sysutils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/sysutils.h b/common/sysutils.h
index ba66ce616..ea92e4c32 100644
--- a/common/sysutils.h
+++ b/common/sysutils.h
@@ -67,6 +67,10 @@ int gnupg_setenv (const char *name, const char *value, int overwrite);
int gnupg_unsetenv (const char *name);
char *gnupg_getcwd (void);
+gpg_error_t gnupg_inotify_watch_socket (int *r_fd, const char *socket_name);
+int gnupg_inotify_has_name (int fd, const char *name);
+
+
#ifdef HAVE_W32_SYSTEM
void *w32_get_user_sid (void);