summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index aede710..7c22092 100644
--- a/src/main.c
+++ b/src/main.c
@@ -53,10 +53,13 @@
53static const char *socket_path = "/var/run/usbmuxd"; 53static const char *socket_path = "/var/run/usbmuxd";
54static const char *lockfile = "/var/run/usbmuxd.pid"; 54static const char *lockfile = "/var/run/usbmuxd.pid";
55 55
56// Global state used in other files
56int should_exit; 57int should_exit;
57int should_discover; 58int should_discover;
58int use_logfile = 0; 59int use_logfile = 0;
60int no_preflight = 0;
59 61
62// Global state for main.c
60static int verbose = 0; 63static int verbose = 0;
61static int foreground = 0; 64static int foreground = 0;
62static int drop_privileges = 0; 65static int drop_privileges = 0;
@@ -151,7 +154,7 @@ static void set_signal_handlers(void)
151 sigaddset(&set, SIGUSR1); 154 sigaddset(&set, SIGUSR1);
152 sigaddset(&set, SIGUSR2); 155 sigaddset(&set, SIGUSR2);
153 sigprocmask(SIG_SETMASK, &set, NULL); 156 sigprocmask(SIG_SETMASK, &set, NULL);
154 157
155 memset(&sa, 0, sizeof(struct sigaction)); 158 memset(&sa, 0, sizeof(struct sigaction));
156 sa.sa_handler = handle_signal; 159 sa.sa_handler = handle_signal;
157 sigaction(SIGINT, &sa, NULL); 160 sigaction(SIGINT, &sa, NULL);
@@ -368,6 +371,7 @@ static void usage()
368 printf(" \tStarting another instance will trigger discovery instead.\n"); 371 printf(" \tStarting another instance will trigger discovery instead.\n");
369 printf(" -z, --enable-exit\tEnable \"--exit\" request from other instances and exit\n"); 372 printf(" -z, --enable-exit\tEnable \"--exit\" request from other instances and exit\n");
370 printf(" \tautomatically if no device is attached.\n"); 373 printf(" \tautomatically if no device is attached.\n");
374 printf(" -p, --no-preflight\tDisable lockdownd preflight on new device.\n");
371#ifdef HAVE_UDEV 375#ifdef HAVE_UDEV
372 printf(" -u, --udev\t\tRun in udev operation mode (implies -n and -z).\n"); 376 printf(" -u, --udev\t\tRun in udev operation mode (implies -n and -z).\n");
373#endif 377#endif
@@ -392,6 +396,7 @@ static void parse_opts(int argc, char **argv)
392 {"user", required_argument, NULL, 'U'}, 396 {"user", required_argument, NULL, 'U'},
393 {"disable-hotplug", no_argument, NULL, 'n'}, 397 {"disable-hotplug", no_argument, NULL, 'n'},
394 {"enable-exit", no_argument, NULL, 'z'}, 398 {"enable-exit", no_argument, NULL, 'z'},
399 {"no-preflight", no_argument, NULL, 'p'},
395#ifdef HAVE_UDEV 400#ifdef HAVE_UDEV
396 {"udev", no_argument, NULL, 'u'}, 401 {"udev", no_argument, NULL, 'u'},
397#endif 402#endif
@@ -407,11 +412,11 @@ static void parse_opts(int argc, char **argv)
407 int c; 412 int c;
408 413
409#ifdef HAVE_SYSTEMD 414#ifdef HAVE_SYSTEMD
410 const char* opts_spec = "hfvVuU:xXsnzl:"; 415 const char* opts_spec = "hfvVuU:xXsnzl:p";
411#elif HAVE_UDEV 416#elif HAVE_UDEV
412 const char* opts_spec = "hfvVuU:xXnzl:"; 417 const char* opts_spec = "hfvVuU:xXnzl:p";
413#else 418#else
414 const char* opts_spec = "hfvVU:xXnzl:"; 419 const char* opts_spec = "hfvVU:xXnzl:p";
415#endif 420#endif
416 421
417 while (1) { 422 while (1) {
@@ -437,6 +442,9 @@ static void parse_opts(int argc, char **argv)
437 drop_privileges = 1; 442 drop_privileges = 1;
438 drop_user = optarg; 443 drop_user = optarg;
439 break; 444 break;
445 case 'p':
446 no_preflight = 1;
447 break;
440#ifdef HAVE_UDEV 448#ifdef HAVE_UDEV
441 case 'u': 449 case 'u':
442 opt_disable_hotplug = 1; 450 opt_disable_hotplug = 1;