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:
Sergey Ponomarev 2024-04-13 12:03:54 +03:00 committed by GitHub
parent fee8491a8e
commit b3c770898a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View File

@ -853,19 +853,19 @@ void write_pid_file(const char* pidfile)
f = fopen(pidfile, "w");
if (!f) {
print_message(msg_system_error, "write_pid_file:%s:%s", pidfile, strerror(errno));
exit(3);
print_message(msg_system_error, "write_pid_file: %s: %s\n", pidfile, strerror(errno));
return;
}
res = fprintf(f, "%d\n", getpid());
if (res < 0) {
print_message(msg_system_error, "write_pid_file:fprintf:%s", strerror(errno));
exit(3);
print_message(msg_system_error, "write_pid_file: fprintf: %s\n", strerror(errno));
return;
}
res = fclose(f);
if (res == EOF) {
print_message(msg_system_error, "write_pid_file:fclose:%s", strerror(errno));
exit(3);
print_message(msg_system_error, "write_pid_file: fclose: %s\n", strerror(errno));
return;
}
}

View File

@ -2239,10 +2239,13 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
/* Parse command line */
nerrors = arg_parse(argc, argv, argtable);
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");
// print options
arg_print_glossary(stdout, argtable, " %-25s\t%s\n");
return -1;
fprintf(stderr, "Invalid args are ignored, please fix them\n");
}