summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-01-25 21:49:34 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-01-25 21:49:34 +0000
commit23683c4a1cd6ad6a8ebe1466c0006ef2b6d777e9 (patch)
tree76fd6c6828f7cf1cc11b4b2d8fe5bf61b6d16638 /lib
parent781769f616b011bb865dfb73595d7ba04815ff9e (diff)
downloadFreeBSD-src-23683c4a1cd6ad6a8ebe1466c0006ef2b6d777e9.zip
FreeBSD-src-23683c4a1cd6ad6a8ebe1466c0006ef2b6d777e9.tar.gz
Use ctime_r to build the timestamp for syslog, so that we don't
clobber a ctime buffer which is passed in. PR: 34022 Submitted by: Hartmut Brandt <brandt@fokus.gmd.de> MFC after: 2 weeks
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/syslog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index d3326ed..b6eab59 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -143,7 +143,7 @@ vsyslog(pri, fmt, ap)
register char ch, *p;
time_t now;
int fd, saved_errno;
- char *stdp, tbuf[2048], fmt_cpy[1024];
+ char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26];
FILE *fp, *fmt_fp;
struct bufcookie tbuf_cookie;
struct bufcookie fmt_cookie;
@@ -176,7 +176,7 @@ vsyslog(pri, fmt, ap)
/* Build the message. */
(void)time(&now);
(void)fprintf(fp, "<%d>", pri);
- (void)fprintf(fp, "%.15s ", ctime(&now) + 4);
+ (void)fprintf(fp, "%.15s ", ctime_r(&now, timbuf) + 4);
if (LogStat & LOG_PERROR) {
/* Transfer to string buffer */
(void)fflush(fp);
OpenPOWER on IntegriCloud