Commit Briefs

Omar Polo

fmt


Omar Polo

use memset(3) rather than bzero(3)

There's no difference, but bzero(3) says STANDARDS The bzero() function conforms to the X/Open System Interfaces option of the IEEE Std 1003.1-2004 (“POSIX.1”) specification. It was removed from the standard in IEEE Std 1003.1-2008 (“POSIX.1”), which recommends using memset(3) instead. so here we are.


Omar Polo

don't crash if -n is given without -c

If -n is given without -c, config_path is still NULL and it would crash due to a NULL deference.


Omar Polo

unbreak configless mode

An un-initialized field in the configless code path leads to a crash on the first request.


Omar Polo

move parse_portno to gmid.c

it's used only to parse the -p flag. While there add check_port_num to check the range for the port.


Omar Polo

style(9)-ify


Omar Polo

initialize the logger early

Initialize the logger as soon as possible and log by default to stderr. With this, some (common?) errors are printed early instead of ending up in syslog. # NB: this is in configless mode % ./gmid -p 80 [2021-07-07 11:05:57] bind: Address already in use % ./gmid -p 81 [2021-07-07 11:13:53] bind: Permission denied %


Omar Polo

gracefully shut down fastcgi backends

we need to delete the events associated with the backends, otherwise the server process won't ever quit. Here, we add a pending counter to every backend and shut down immediately if they aren't handling any client; otherwise we try to close them as soon as possible (i.e. when they close the connection to the last connected client.)


Omar Polo

reset fcgi array in free_config

otherwise path, port and/or prog could become an invalid pointer.




Omar Polo

define GMID_STRING and reuse-it

GMID_VERSION follows the CGI/FastCGI style, i.e. project_name/version. Define GMID_STRING with a more "human" variant "project_name version", and reuse that in the --help and --version codepath.


Omar Polo

add version in usage


Omar Polo

use getprogname() in usage()