Patch from Bastian Blank:
No binary (build failed)
—
(log yok)
| @@ -249,9 +249,6 @@ extern int vdprintf(int d, const char *format, va_list ap); | |
| int nfsmount(const char *spec, const char *node, int *flags, | |
| char **extra_opts, char **mount_opts, int running_bg); | |
| - | void syslog_msg_with_name(const char *name, int facility, int pri, const char *msg); |
| - | void syslog_msg(int facility, int pri, const char *msg); |
| - | |
| /* Include our own copy of struct sysinfo to avoid binary compatability | |
| * problems with Linux 2.4, which changed things. Grumble, grumble. */ | |
| struct sysinfo { | |
| @@ -229,7 +229,9 @@ static void message(int device, const char *fmt, ...) | |
| /* Log the message to syslogd */ | |
| if (device & LOG) { | |
| /* don`t out "\r\n" */ | |
| - | syslog_msg(LOG_DAEMON, LOG_INFO, msg + 1); |
| + | openlog(bb_applet_name, 0, LOG_DAEMON); |
| + | syslog(LOG_INFO, "%s", msg); |
| + | closelog(); |
| } | |
| msg[l++] = '\n'; | |
| @@ -41,7 +41,7 @@ LIBBB_SRC:= \ | |
| read_package_field.c recursive_action.c remove_file.c \ | |
| restricted_shell.c run_parts.c run_shell.c safe_read.c safe_write.c \ | |
| safe_strncpy.c setup_environment.c simplify_path.c syscalls.c \ | |
| - | syslog_msg_with_name.c trim.c u_signal_names.c vdprintf.c verror_msg.c \ |
| + | trim.c u_signal_names.c vdprintf.c verror_msg.c \ |
| vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c \ | |
| xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \ | |
| get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \ | |
| @@ -1,45 +0,0 @@ | |
| - | /* vi: set sw=4 ts=4: */ |
| - | /* |
| - | * Utility routines. |
| - | * |
| - | * Copyright (C) 1999-2004 by Erik Andersen <[email protected]> |
| - | * |
| - | * This program is free software; you can redistribute it and/or modify |
| - | * it under the terms of the GNU General Public License as published by |
| - | * the Free Software Foundation; either version 2 of the License, or |
| - | * (at your option) any later version. |
| - | * |
| - | * This program is distributed in the hope that it will be useful, |
| - | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| - | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| - | * General Public License for more details. |
| - | * |
| - | * You should have received a copy of the GNU General Public License |
| - | * along with this program; if not, write to the Free Software |
| - | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| - | */ |
| - | |
| - | #include <stdio.h> |
| - | #include <sys/syslog.h> |
| - | #include "libbb.h" |
| - | |
| - | void syslog_msg_with_name(const char *name, int facility, int pri, const char *msg) |
| - | { |
| - | openlog(name, 0, facility); |
| - | syslog(pri, "%s", msg); |
| - | closelog(); |
| - | } |
| - | |
| - | void syslog_msg(int facility, int pri, const char *msg) |
| - | { |
| - | syslog_msg_with_name(bb_applet_name, facility, pri, msg); |
| - | } |
| - | |
| - | /* END CODE */ |
| - | /* |
| - | Local Variables: |
| - | c-file-style: "linux" |
| - | c-basic-offset: 4 |
| - | tab-width: 4 |
| - | End: |
| - | */ |
| @@ -998,7 +998,9 @@ static void error(const char *fmt, ...) | |
| va_end(va_alist); | |
| #ifdef USE_SYSLOG | |
| - | syslog_msg(LOG_AUTH, LOG_ERR, buf); |
| + | openlog(bb_applet_name, 0, LOG_AUTH); |
| + | syslog(LOG_ERR, "%s", buf); |
| + | closelog(); |
| #else | |
| strncat(bp, "\r\n", 256 - strlen(buf)); | |
| buf[255] = 0; | |
| @@ -1,4 +1,4 @@ | |
| - | /* $Id: telnetd.c,v 1.11 2004/03/15 08:28:53 andersen Exp $ |
| + | /* $Id: telnetd.c,v 1.12 2004/06/22 10:07:17 andersen Exp $ |
| * | |
| * Simple telnet server | |
| * Bjorn Wesen, Axis Communications AB ([email protected]) | |
| @@ -269,7 +269,7 @@ make_new_session(int sockfd) | |
| pty = getpty(tty_name); | |
| if (pty < 0) { | |
| - | syslog_msg(LOG_USER, LOG_ERR, "All network ports in use!"); |
| + | syslog(LOG_ERR, "All network ports in use!"); |
| return 0; | |
| } | |
| @@ -292,7 +292,7 @@ make_new_session(int sockfd) | |
| if ((pid = fork()) < 0) { | |
| - | syslog_msg(LOG_USER, LOG_ERR, "Can`t forking"); |
| + | syslog(LOG_ERR, "Can`t forking"); |
| } | |
| if (pid == 0) { | |
| /* In child, open the child's side of the tty. */ | |
| @@ -304,7 +304,7 @@ make_new_session(int sockfd) | |
| setsid(); | |
| if (open(tty_name, O_RDWR /*| O_NOCTTY*/) < 0) { | |
| - | syslog_msg(LOG_USER, LOG_ERR, "Could not open tty"); |
| + | syslog(LOG_ERR, "Could not open tty"); |
| exit(1); | |
| } | |
| dup(0); | |
| @@ -330,7 +330,7 @@ make_new_session(int sockfd) | |
| execv(loginpath, (char *const *)argv_init); | |
| /* NOT REACHED */ | |
| - | syslog_msg(LOG_USER, LOG_ERR, "execv error"); |
| + | syslog(LOG_ERR, "execv error"); |
| exit(1); | |
| } | |
| @@ -422,6 +422,8 @@ telnetd_main(int argc, char **argv) | |
| argv_init[0] = loginpath; | |
| + | openlog(bb_applet_name, 0, LOG_USER); |
| + | |
| #ifdef CONFIG_FEATURE_TELNETD_INETD | |
| maxfd = 1; | |
| sessions = make_new_session(); | |
| @@ -47,8 +47,8 @@ static void klogd_signal(int sig) | |
| klogctl(7, NULL, 0); | |
| klogctl(0, 0, 0); | |
| /* logMessage(0, "Kernel log daemon exiting."); */ | |
| - | syslog_msg(LOG_SYSLOG, LOG_NOTICE, "Kernel log daemon exiting."); |
| - | exit(TRUE); |
| + | syslog(LOG_NOTICE, "Kernel log daemon exiting."); |
| + | exit(EXIT_SUCCESS); |
| } | |
| static void doKlogd(const char console_log_level) __attribute__ ((noreturn)); | |
| @@ -59,6 +59,8 @@ static void doKlogd(const char console_log_level) | |
| int i, n, lastc; | |
| char *start; | |
| + | openlog("kernel", 0, LOG_KERN); |
| + | |
| /* Set up sig handlers */ | |
| signal(SIGINT, klogd_signal); | |
| signal(SIGKILL, klogd_signal); | |
| @@ -72,22 +74,17 @@ static void doKlogd(const char console_log_level) | |
| if (console_log_level) | |
| klogctl(8, NULL, console_log_level); | |
| - | syslog_msg(LOG_SYSLOG, LOG_NOTICE, "klogd started: " BB_BANNER); |
| + | syslog(LOG_NOTICE, "klogd started: " BB_BANNER); |
| while (1) { | |
| /* Use kernel syscalls */ | |
| memset(log_buffer, '\0', sizeof(log_buffer)); | |
| n = klogctl(2, log_buffer, sizeof(log_buffer)); | |
| if (n < 0) { | |
| - | char message[80]; |
| - | |
| if (errno == EINTR) | |
| continue; | |
| - | snprintf(message, 79, |
| - | "klogd: Error return from sys_sycall: %d - %s.\n", errno, |
| - | strerror(errno)); |
| - | syslog_msg(LOG_SYSLOG, LOG_ERR, message); |
| - | exit(1); |
| + | syslog(LOG_ERR, "klogd: Error return from sys_sycall: %d - %s.\n", errno, strerror(errno)); |
| + | exit(EXIT_FAILURE); |
| } | |
| /* klogctl buffer parsing modelled after code in dmesg.c */ | |
| @@ -107,7 +104,7 @@ static void doKlogd(const char console_log_level) | |
| } | |
| if (log_buffer[i] == '\n') { | |
| log_buffer[i] = '\0'; /* zero terminate this message */ | |
| - | syslog_msg(LOG_KERN, priority, start); |
| + | syslog(priority, start); |
| start = &log_buffer[i + 1]; | |
| priority = LOG_INFO; | |
| } | |