diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-04-14 00:40:31 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-04-14 00:40:31 +0000 |
commit | d5ba77d03ee32b6757005ebd58c04b845b3a151a (patch) | |
tree | 0710d11a3289c6e31cb63839754da288afda7636 /sysklogd | |
parent | 50ed0676ad017742c2cd1b2b5b02a0ed268c37bc (diff) | |
download | busybox-w32-d5ba77d03ee32b6757005ebd58c04b845b3a151a.tar.gz busybox-w32-d5ba77d03ee32b6757005ebd58c04b845b3a151a.tar.bz2 busybox-w32-d5ba77d03ee32b6757005ebd58c04b845b3a151a.zip |
Latest and greatest. Seems there is a bug.
-Erik
Diffstat (limited to 'sysklogd')
-rw-r--r-- | sysklogd/syslogd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 357fa6d5e..ec372fc56 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <sys/un.h> | 37 | #include <sys/un.h> |
38 | #include <time.h> | 38 | #include <time.h> |
39 | #include <unistd.h> | 39 | #include <unistd.h> |
40 | #include <limits.h> | ||
41 | 40 | ||
42 | #define ksyslog klogctl | 41 | #define ksyslog klogctl |
43 | extern int ksyslog(int type, char *buf, int len); | 42 | extern int ksyslog(int type, char *buf, int len); |
@@ -76,7 +75,7 @@ static const char syslogd_usage[] = | |||
76 | /* Note: There is also a function called "message()" in init.c */ | 75 | /* Note: There is also a function called "message()" in init.c */ |
77 | /* Print a message to the log file. */ | 76 | /* Print a message to the log file. */ |
78 | static void message(char *fmt, ...) | 77 | static void message(char *fmt, ...) |
79 | __attribute__ ((format (printf, 1, 2))); | 78 | __attribute__ ((format (printf, 1, 2))); |
80 | static void message(char *fmt, ...) | 79 | static void message(char *fmt, ...) |
81 | { | 80 | { |
82 | int fd; | 81 | int fd; |
@@ -169,7 +168,6 @@ static void doSyslogd (void) | |||
169 | int sock_fd; | 168 | int sock_fd; |
170 | fd_set readfds; | 169 | fd_set readfds; |
171 | char lfile[PATH_MAX]; | 170 | char lfile[PATH_MAX]; |
172 | int t = readlink(_PATH_LOG, lfile, sizeof(lfile) - 1); /* Resolve symlinks */ | ||
173 | 171 | ||
174 | /* Set up sig handlers */ | 172 | /* Set up sig handlers */ |
175 | signal (SIGINT, quit_signal); | 173 | signal (SIGINT, quit_signal); |
@@ -179,10 +177,15 @@ static void doSyslogd (void) | |||
179 | signal (SIGALRM, domark); | 177 | signal (SIGALRM, domark); |
180 | alarm (MarkInterval); | 178 | alarm (MarkInterval); |
181 | 179 | ||
182 | if (t == -1) | 180 | /* create the syslog file so realpath() can work |
183 | strncpy(lfile, _PATH_LOG, sizeof(lfile)); | 181 | * (the ugle close(open()) stuff is just a cheap |
184 | else | 182 | * touch command that avoids using system (system |
185 | lfile[t] = '\0'; | 183 | * is always a bad thing to use) */ |
184 | close(open("touch " _PATH_LOG, O_RDWR | O_CREAT, 0644)); | ||
185 | if (realpath(_PATH_LOG, lfile) == NULL) { | ||
186 | perror("Could not resolv path to " _PATH_LOG); | ||
187 | exit (FALSE); | ||
188 | } | ||
186 | 189 | ||
187 | unlink (lfile); | 190 | unlink (lfile); |
188 | 191 | ||
@@ -243,6 +246,7 @@ static void doSyslogd (void) | |||
243 | n_read = read (fd, buf, BUFSIZE); | 246 | n_read = read (fd, buf, BUFSIZE); |
244 | 247 | ||
245 | if (n_read < 0) { | 248 | if (n_read < 0) { |
249 | // FIXME .. fd isn't set | ||
246 | perror ("read error"); | 250 | perror ("read error"); |
247 | goto close_fd; | 251 | goto close_fd; |
248 | } | 252 | } |