mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-13 07:37:15 +03:00
Ignore opts (#436)
* Be less strict about args at startup Ignore unknown options. * Don't fail if pid file is accessible
This commit is contained in:
parent
fee8491a8e
commit
b3c770898a
12
common.c
12
common.c
@ -853,19 +853,19 @@ void write_pid_file(const char* pidfile)
|
|||||||
|
|
||||||
f = fopen(pidfile, "w");
|
f = fopen(pidfile, "w");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
print_message(msg_system_error, "write_pid_file:%s:%s", pidfile, strerror(errno));
|
print_message(msg_system_error, "write_pid_file: %s: %s\n", pidfile, strerror(errno));
|
||||||
exit(3);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = fprintf(f, "%d\n", getpid());
|
res = fprintf(f, "%d\n", getpid());
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
print_message(msg_system_error, "write_pid_file:fprintf:%s", strerror(errno));
|
print_message(msg_system_error, "write_pid_file: fprintf: %s\n", strerror(errno));
|
||||||
exit(3);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = fclose(f);
|
res = fclose(f);
|
||||||
if (res == EOF) {
|
if (res == EOF) {
|
||||||
print_message(msg_system_error, "write_pid_file:fclose:%s", strerror(errno));
|
print_message(msg_system_error, "write_pid_file: fclose: %s\n", strerror(errno));
|
||||||
exit(3);
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2239,10 +2239,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
|
|||||||
/* Parse command line */
|
/* Parse command line */
|
||||||
nerrors = arg_parse(argc, argv, argtable);
|
nerrors = arg_parse(argc, argv, argtable);
|
||||||
if (nerrors) {
|
if (nerrors) {
|
||||||
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
|
// print bad args
|
||||||
|
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
|
||||||
|
// print usage
|
||||||
arg_print_syntax(stdout, argtable, "\n");
|
arg_print_syntax(stdout, argtable, "\n");
|
||||||
|
// print options
|
||||||
arg_print_glossary(stdout, argtable, " %-25s\t%s\n");
|
arg_print_glossary(stdout, argtable, " %-25s\t%s\n");
|
||||||
return -1;
|
fprintf(stderr, "Invalid args are ignored, please fix them\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user