Now the daemon manages its privileges correctly, so that -rp, -u,
-g and -lp can be supported, also in a Solaris zone.
Also fixed a problem that switch_log_printf() was used before the
logger was initialized, so the messages were sent to nowhere.
This does not appear to be needed any longer, and while this is in
place a dependent library that tries to start a child process will
hang waiting on the SIG_CHLD signal that the FreeSWITCH core 'ate'.
FS-7250 #resolve
When -reincarnate-reexec is given we run execv to restart FS. If
argv[0] isn't a full pathname then execv is going to fail. While not
common for a FS system started by init, this is a common occurrence
when FS is started from the shell.
Now if execv fails, we'll try execvp. If that fails too then we'll
fall back on the normal reincarnation behavior.
Previously what would happen in that case is god would descend from
the heavens and become mortal. Leaving heaven absent, all hope for
reincarnation was lost.
(That is, we'd simply return from reincarnate_protect and the
supervisor process would become the new instance of FS, so the trick
would only work once.)
If we receive SIGTERM or SIGILL we should propagate the signal to the
child FS process. As FS normally handles these signals, we need to
restore the handler before we refork.
FS may also add a handler for SIGCHLD; we need the default action
here instead for the parent.
Our main version string is designed for release engineering purposes:
it matches file name conventions used for versioned tarballs and the
versions sort lexicographically while containing all pertinent
information.
With this commit we add in parentheses a more human-friendly rendering
of the version string: we spell out the meaning of each field and
render the datetime in RFC 822 notation.
Use a chain of "else if" statements, drop known_opt completely.
Added bonus: We stop trying to parse option arguments as (possible) options.
Arguments of -u/-g and path options (-conf) now check whether their argument
starts with a dash ('-') and error out in case it does (= next option, not a valid argument).
Use PATH_MAX for everything that stores files / directories.
Use switch_bool_t and SWITCH_TRUE/_FALSE for boolean variables.
Use EXIT_SUCCESS/_FAILURE for exit() calls.
Get rid of excessive indenting (especially in the win32 parts of main()).
NOTE: Win32 parts untested.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Move empty cmdline option string check and "-help/-h/-?" handling to top of loop.
Emit a proper error message for unknown options. (Just displaying the
usage description, but not telling the user which option was wrong, is bad mojo).
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>