-
-
-void udhcp_logging(int level, const char *fmt, ...)
-{
- va_list p;
-
- va_start(p, fmt);
- if (!daemonized) {
- printf("%s, ", syslog_level_msg[level]);
- vprintf(fmt, p);
- putchar('\n');
- }
- va_end(p);
-}
-#endif
-
-
-void udhcp_start_log_and_pid(const char *client_server, const char *pidfile)
-{
- int pid_fd;
-
- /* Make sure our syslog fd isn't overwritten */
- sanitize_fds();
-
- /* do some other misc startup stuff while we are here to save bytes */
- pid_fd = pidfile_acquire(pidfile);
- pidfile_write_release(pid_fd);
-
- /* equivelent of doing a fflush after every \n */
- setlinebuf(stdout);
-
- if (ENABLE_FEATURE_UDHCP_SYSLOG)
- openlog(client_server, LOG_PID | LOG_CONS, LOG_LOCAL0);
-
- udhcp_logging(LOG_INFO, "%s (v%s) started", client_server, BB_VER);
-}