summaryrefslogtreecommitdiffstats
path: root/libusbmuxd
diff options
context:
space:
mode:
authorGravatar Martin S2012-04-07 21:09:01 +0200
committerGravatar Martin S2012-04-07 21:09:01 +0200
commitf76874b807f5595e54752ba4973eba1d57ff7621 (patch)
treeff7c8b04ae0ada1ff23b7c98fb7e152b2008e328 /libusbmuxd
parentf0836404b382747aeba03ee2cae9c3f16420fb66 (diff)
downloadusbmuxd-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.
Diffstat (limited to 'libusbmuxd')
-rw-r--r--libusbmuxd/libusbmuxd.c10
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()
411static int usbmuxd_listen_inotify() 411static int usbmuxd_listen_inotify()
412{ 412{
413 int inot_fd; 413 int inot_fd;
414 int watch_fd; 414 int watch_d;
415 int sfd; 415 int sfd;
416 416
417 sfd = connect_usbmuxd_socket(); 417 sfd = connect_usbmuxd_socket();
@@ -426,9 +426,9 @@ static int usbmuxd_listen_inotify()
426 } 426 }
427 427
428 /* inotify is setup, listen for events that concern us */ 428 /* inotify is setup, listen for events that concern us */
429 watch_fd = inotify_add_watch (inot_fd, USBMUXD_DIRNAME, IN_CREATE); 429 watch_d = inotify_add_watch (inot_fd, USBMUXD_DIRNAME, IN_CREATE);
430 if (watch_fd < 0) { 430 if (watch_d < 0) {
431 fprintf (stderr, "Failed to setup watch for socket dir\n"); 431 fprintf (stderr, "Failed to setup watch descriptor for socket dir\n");
432 close (inot_fd); 432 close (inot_fd);
433 return -2; 433 return -2;
434 } 434 }
@@ -457,7 +457,7 @@ static int usbmuxd_listen_inotify()
457 } 457 }
458 458
459end: 459end:
460 close(watch_fd); 460 inotify_rm_watch(inot_fd, watch_d);
461 close(inot_fd); 461 close(inot_fd);
462 462
463 return sfd; 463 return sfd;