mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Added protection against running under launchd
This commit is contained in:
1 parent
fed2057a33
commit
bda8e90733
1 file changed
+11
-5
@@ -252,12 +252,18 @@ static void process_command_line_arguments(char *argv[], char **options) {
|
|||||||
(void) fclose(fp);
|
(void) fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle command line flags. They override config file and default settings.
|
// If we're under MacOS and started by launchd, then the second
|
||||||
for (i = cmd_line_opts_start; argv[i] != NULL; i += 2) {
|
// argument is process serial number, -psn_.....
|
||||||
if (argv[i][0] != '-' || argv[i + 1] == NULL) {
|
// In this case, don't process arguments at all.
|
||||||
show_usage_and_exit();
|
if (argv[1] == NULL || memcmp(argv[1], "-psn_", 5) != 0) {
|
||||||
|
// Handle command line flags.
|
||||||
|
// They override config file and default settings.
|
||||||
|
for (i = cmd_line_opts_start; argv[i] != NULL; i += 2) {
|
||||||
|
if (argv[i][0] != '-' || argv[i + 1] == NULL) {
|
||||||
|
show_usage_and_exit();
|
||||||
|
}
|
||||||
|
set_option(options, &argv[i][1], argv[i + 1]);
|
||||||
}
|
}
|
||||||
set_option(options, &argv[i][1], argv[i + 1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user