void save_inetd_socket_descriptor (void) { inetd_socket_descriptor = INETD_SOCKET_DESCRIPTOR; #if defined(HAVE_DUP) && defined(HAVE_DUP2) /* use handle passed by inetd/xinetd */ if ((inetd_socket_descriptor = dup (INETD_SOCKET_DESCRIPTOR)) < 0) msg (M_ERR, "INETD_SOCKET_DESCRIPTOR dup(%d) failed", INETD_SOCKET_DESCRIPTOR); set_std_files_to_null (true); #endif }
void open_syslog (const char *pgmname, bool stdio_to_null) { #if SYSLOG_CAPABILITY if (!msgfp && !std_redir) { if (!use_syslog) { pgmname_syslog = string_alloc (pgmname ? pgmname : PACKAGE, NULL); openlog (pgmname_syslog, LOG_PID, LOG_OPENVPN); use_syslog = true; /* Better idea: somehow pipe stdout/stderr output to msg() */ if (stdio_to_null) set_std_files_to_null (false); } } #else msg (M_WARN, "Warning on use of --daemon/--inetd: this operating system lacks daemon logging features, therefore when I become a daemon, I won't be able to log status or error messages"); #endif }