Skip to content

Commit b3c7708

Browse files
authored
Ignore opts (#436)
* Be less strict about args at startup Ignore unknown options. * Don't fail if pid file is accessible
1 parent fee8491 commit b3c7708

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

common.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -853,19 +853,19 @@ void write_pid_file(const char* pidfile)
853853

854854
f = fopen(pidfile, "w");
855855
if (!f) {
856-
print_message(msg_system_error, "write_pid_file:%s:%s", pidfile, strerror(errno));
857-
exit(3);
856+
print_message(msg_system_error, "write_pid_file: %s: %s\n", pidfile, strerror(errno));
857+
return;
858858
}
859859

860860
res = fprintf(f, "%d\n", getpid());
861861
if (res < 0) {
862-
print_message(msg_system_error, "write_pid_file:fprintf:%s", strerror(errno));
863-
exit(3);
862+
print_message(msg_system_error, "write_pid_file: fprintf: %s\n", strerror(errno));
863+
return;
864864
}
865865

866866
res = fclose(f);
867867
if (res == EOF) {
868-
print_message(msg_system_error, "write_pid_file:fclose:%s", strerror(errno));
869-
exit(3);
868+
print_message(msg_system_error, "write_pid_file: fclose: %s\n", strerror(errno));
869+
return;
870870
}
871871
}

sslh-conf.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -2239,10 +2239,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
22392239
/* Parse command line */
22402240
nerrors = arg_parse(argc, argv, argtable);
22412241
if (nerrors) {
2242-
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
2242+
// print bad args
2243+
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
2244+
// print usage
22432245
arg_print_syntax(stdout, argtable, "\n");
2246+
// print options
22442247
arg_print_glossary(stdout, argtable, " %-25s\t%s\n");
2245-
return -1;
2248+
fprintf(stderr, "Invalid args are ignored, please fix them\n");
22462249
}
22472250

22482251

0 commit comments

Comments
 (0)