aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-05-19 18:50:11 +0200
committerDuncaen <mail@duncano.de>2017-05-19 18:50:11 +0200
commit28544362f0299fcb2f2d0257d2ea194070cb6d54 (patch)
tree7f7b873043382e881ac192383f05e0c60684635c
parentf7fb0e0302ad61b386c5303b0b66b01a353047c8 (diff)
downloadlobase-28544362f0299fcb2f2d0257d2ea194070cb6d54.tar.gz
usr.bin/newsyslog: update to OPENBSD_6_1
-rw-r--r--usr.bin/newsyslog/newsyslog.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c
index 0120e56..b327c53 100644
--- a/usr.bin/newsyslog/newsyslog.c
+++ b/usr.bin/newsyslog/newsyslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newsyslog.c,v 1.101 2016/06/01 16:57:48 tedu Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.102 2017/03/16 10:32:01 bluhm Exp $ */
/*
* Copyright (c) 1999, 2002, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -142,7 +142,7 @@ int force = 0; /* Force the logs to be rotated */
char *conf = CONF; /* Configuration file to use */
time_t timenow;
char hostname[HOST_NAME_MAX+1]; /* Hostname */
-char *daytime; /* timenow in human readable form */
+char daytime[33]; /* timenow in human readable form */
char *arcdir; /* Dir to put archives in (if it exists) */
FILE *openmail(void);
@@ -402,12 +402,18 @@ send_signal(char *pidfile, int signal)
void
parse_args(int argc, char **argv)
{
+ struct timeval now;
+ struct tm *tm;
+ size_t l;
char *p;
int ch;
- timenow = time(NULL);
- daytime = ctime(&timenow) + 4;
- daytime[15] = '\0';
+ gettimeofday(&now, NULL);
+ timenow = now.tv_sec;
+ tm = gmtime(&now.tv_sec);
+ l = strftime(daytime, sizeof(daytime), "%FT%T", tm);
+ snprintf(daytime + l, sizeof(daytime) - l, ".%03ldZ",
+ now.tv_usec / 1000);
/* Let's get our hostname */
(void)gethostname(hostname, sizeof(hostname));