summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-04-07 15:34:19 +0200
committerGravatar Nikias Bassen2012-04-07 15:34:19 +0200
commitfabab8cb80ea87419afa7a1ccf4627e5e56da5e5 (patch)
tree74b45cbf7dbdf31aeb24c554bf2f8fc4e1093923
parent4113b710122aeb213a872c467a9616e303188e04 (diff)
downloadusbmuxd-fabab8cb80ea87419afa7a1ccf4627e5e56da5e5.tar.gz
usbmuxd-fabab8cb80ea87419afa7a1ccf4627e5e56da5e5.tar.bz2
libusbmuxd: only fall back to polling if inotify setup fails
-rw-r--r--libusbmuxd/libusbmuxd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c
index 4c94dc2..4195960 100644
--- a/libusbmuxd/libusbmuxd.c
+++ b/libusbmuxd/libusbmuxd.c
@@ -422,7 +422,7 @@ static int usbmuxd_listen_inotify()
422 inot_fd = inotify_init (); 422 inot_fd = inotify_init ();
423 if (inot_fd < 0) { 423 if (inot_fd < 0) {
424 fprintf (stderr, "Failed to setup inotify\n"); 424 fprintf (stderr, "Failed to setup inotify\n");
425 return -1; 425 return -2;
426 } 426 }
427 427
428 /* inotify is setup, listen for events that concern us */ 428 /* inotify is setup, listen for events that concern us */
@@ -430,7 +430,7 @@ static int usbmuxd_listen_inotify()
430 if (watch_fd < 0) { 430 if (watch_fd < 0) {
431 fprintf (stderr, "Failed to setup watch for socket dir\n"); 431 fprintf (stderr, "Failed to setup watch for socket dir\n");
432 close (inot_fd); 432 close (inot_fd);
433 return -1; 433 return -2;
434 } 434 }
435 435
436 while (1) { 436 while (1) {
@@ -478,7 +478,7 @@ retry:
478 478
479#ifdef HAVE_INOTIFY 479#ifdef HAVE_INOTIFY
480 sfd = usbmuxd_listen_inotify(); 480 sfd = usbmuxd_listen_inotify();
481 if (sfd < 0) 481 if (sfd == -2)
482 sfd = usbmuxd_listen_poll(); 482 sfd = usbmuxd_listen_poll();
483#else 483#else
484 sfd = usbmuxd_listen_poll(); 484 sfd = usbmuxd_listen_poll();