diff options
author | Martin S | 2012-04-07 21:09:01 +0200 |
---|---|---|
committer | Martin S | 2012-04-07 21:09:01 +0200 |
commit | f76874b807f5595e54752ba4973eba1d57ff7621 (patch) | |
tree | ff7c8b04ae0ada1ff23b7c98fb7e152b2008e328 | |
parent | f0836404b382747aeba03ee2cae9c3f16420fb66 (diff) | |
download | usbmuxd-f76874b807f5595e54752ba4973eba1d57ff7621.tar.gz usbmuxd-f76874b807f5595e54752ba4973eba1d57ff7621.tar.bz2 |
libusbmuxd: Do not close inotify watch descriptor like a file descriptor
This caused stdout (fd 1) to be closed in certain situations which does not
happen any longer.
-rw-r--r-- | libusbmuxd/libusbmuxd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c index d9cbd71..6d4504b 100644 --- a/libusbmuxd/libusbmuxd.c +++ b/libusbmuxd/libusbmuxd.c @@ -411,7 +411,7 @@ static int usbmuxd_listen_poll() static int usbmuxd_listen_inotify() { int inot_fd; - int watch_fd; + int watch_d; int sfd; sfd = connect_usbmuxd_socket(); @@ -426,9 +426,9 @@ static int usbmuxd_listen_inotify() } /* inotify is setup, listen for events that concern us */ - watch_fd = inotify_add_watch (inot_fd, USBMUXD_DIRNAME, IN_CREATE); - if (watch_fd < 0) { - fprintf (stderr, "Failed to setup watch for socket dir\n"); + watch_d = inotify_add_watch (inot_fd, USBMUXD_DIRNAME, IN_CREATE); + if (watch_d < 0) { + fprintf (stderr, "Failed to setup watch descriptor for socket dir\n"); close (inot_fd); return -2; } @@ -457,7 +457,7 @@ static int usbmuxd_listen_inotify() } end: - close(watch_fd); + inotify_rm_watch(inot_fd, watch_d); close(inot_fd); return sfd; |