Reject unsupported server arguments
This commit is contained in:
+23
-1
@@ -1866,17 +1866,39 @@ int precompile_unit_generation()
|
||||
return(total.failed == 0 && !candidate_rejected ? 0 : 1);
|
||||
}
|
||||
|
||||
void print_fastcgi_usage(FILE* stream)
|
||||
{
|
||||
fprintf(stream,
|
||||
"Usage: uce_fastcgi [--precompile]\n"
|
||||
" uce_fastcgi --help\n\n"
|
||||
"Without options, start the FastCGI server.\n"
|
||||
" --precompile Compile the current source generation without starting listeners.\n"
|
||||
" -h, --help Show this help and exit.\n");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// systemd connects stdout to a pipe, which otherwise block-buffers child
|
||||
// diagnostics and assigns stale failures a misleading later journal time.
|
||||
setvbuf(stdout, 0, _IOLBF, 0);
|
||||
setvbuf(stderr, 0, _IONBF, 0);
|
||||
if(argc == 2 && (String(argv[1]) == "--help" || String(argv[1]) == "-h"))
|
||||
{
|
||||
print_fastcgi_usage(stdout);
|
||||
return(0);
|
||||
}
|
||||
bool precompile = argc == 2 && String(argv[1]) == "--precompile";
|
||||
if(argc != 1 && !precompile)
|
||||
{
|
||||
fprintf(stderr, "invalid arguments\n");
|
||||
print_fastcgi_usage(stderr);
|
||||
return(2);
|
||||
}
|
||||
// Warm up libgcc's backtrace state so the first in-handler backtrace()
|
||||
// after a fault does not allocate.
|
||||
backtrace(request_fault_frames, 4);
|
||||
process_start_directory();
|
||||
if(argc == 2 && String(argv[1]) == "--precompile")
|
||||
if(precompile)
|
||||
return(precompile_unit_generation());
|
||||
|
||||
init_base_process();
|
||||
|
||||
Reference in New Issue
Block a user