diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-08 17:31:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-08 17:31:55 +0000 |
commit | bd8f43dbab871d19484887556632af50749786b6 (patch) | |
tree | aff74eaa70da2da4ea68915687eeb354df2f74da /sysklogd/syslogd.c | |
parent | 9a9edf200b797a92380b634d57dec6cd9410919f (diff) | |
download | busybox-w32-bd8f43dbab871d19484887556632af50749786b6.tar.gz busybox-w32-bd8f43dbab871d19484887556632af50749786b6.tar.bz2 busybox-w32-bd8f43dbab871d19484887556632af50749786b6.zip |
few random readability enhansements. No code changes
Diffstat (limited to 'sysklogd/syslogd.c')
-rw-r--r-- | sysklogd/syslogd.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index a8b52b36e..f3de04653 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -277,9 +277,9 @@ static void message(char *fmt, ...) | |||
277 | 277 | ||
278 | } else | 278 | } else |
279 | #endif | 279 | #endif |
280 | if ((fd = device_open(logFilePath, | 280 | fd = device_open(logFilePath, O_WRONLY | O_CREAT |
281 | O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND | | 281 | | O_NOCTTY | O_APPEND | O_NONBLOCK); |
282 | O_NONBLOCK)) >= 0) { | 282 | if (fd >= 0) { |
283 | fl.l_type = F_WRLCK; | 283 | fl.l_type = F_WRLCK; |
284 | fcntl(fd, F_SETLKW, &fl); | 284 | fcntl(fd, F_SETLKW, &fl); |
285 | 285 | ||
@@ -291,7 +291,8 @@ static void message(char *fmt, ...) | |||
291 | && (lseek(fd,0,SEEK_END) > logFileSize) ) { | 291 | && (lseek(fd,0,SEEK_END) > logFileSize) ) { |
292 | if(logFileRotate > 0) { | 292 | if(logFileRotate > 0) { |
293 | int i; | 293 | int i; |
294 | char oldFile[(strlen(logFilePath)+4)], newFile[(strlen(logFilePath)+4)]; | 294 | char oldFile[(strlen(logFilePath)+4)]; |
295 | char newFile[(strlen(logFilePath)+4)]; | ||
295 | for(i=logFileRotate-1;i>0;i--) { | 296 | for(i=logFileRotate-1;i>0;i--) { |
296 | sprintf(oldFile, "%s.%d", logFilePath, i-1); | 297 | sprintf(oldFile, "%s.%d", logFilePath, i-1); |
297 | sprintf(newFile, "%s.%d", logFilePath, i); | 298 | sprintf(newFile, "%s.%d", logFilePath, i); |
@@ -321,8 +322,8 @@ static void message(char *fmt, ...) | |||
321 | close(fd); | 322 | close(fd); |
322 | } else { | 323 | } else { |
323 | /* Always send console messages to /dev/console so people will see them. */ | 324 | /* Always send console messages to /dev/console so people will see them. */ |
324 | if ((fd = device_open(_PATH_CONSOLE, | 325 | fd = device_open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY | O_NONBLOCK); |
325 | O_WRONLY | O_NOCTTY | O_NONBLOCK)) >= 0) { | 326 | if (fd >= 0) { |
326 | va_start(arguments, fmt); | 327 | va_start(arguments, fmt); |
327 | vdprintf(fd, fmt, arguments); | 328 | vdprintf(fd, fmt, arguments); |
328 | va_end(arguments); | 329 | va_end(arguments); |