summaryrefslogtreecommitdiffstats
path: root/src/libusbmuxd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libusbmuxd.c')
-rw-r--r--src/libusbmuxd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index d38d850..af8636b 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -574,7 +574,14 @@ static int usbmuxd_listen_inotify()
pevent->len &&
pevent->name[0] != 0 &&
strcmp(pevent->name, USBMUXD_SOCKET_NAME) == 0) {
- sfd = connect_usbmuxd_socket ();
+ /* retry if usbmuxd isn't ready yet */
+ int retry = 10;
+ while (--retry >= 0) {
+ if ((sfd = connect_usbmuxd_socket ()) >= 0) {
+ break;
+ }
+ sleep(1);
+ }
goto end;
}
i += EVENT_SIZE + pevent->len;