summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2016-05-22 11:15:31 +0000
committergilles <gilles@openbsd.org>2016-05-22 11:15:31 +0000
commit2d6a6d317261327ffc18529ce7fc2c66ca3bcfed (patch)
treed97bf7c8094ef5ca7aa639d6528a4e3ba4d9b903
parentforce long filenames on the initial fat16 mount here as well (diff)
downloadwireguard-openbsd-2d6a6d317261327ffc18529ce7fc2c66ca3bcfed.tar.xz
wireguard-openbsd-2d6a6d317261327ffc18529ce7fc2c66ca3bcfed.zip
use temporary variables to store some struct tm values, no functional
change but reduces the changeset with portable version
-rw-r--r--usr.sbin/smtpd/to.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/to.c b/usr.sbin/smtpd/to.c
index 5cc2da51bb2..f8724203c55 100644
--- a/usr.sbin/smtpd/to.c
+++ b/usr.sbin/smtpd/to.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: to.c,v 1.26 2016/02/15 12:53:50 mpi Exp $ */
+/* $OpenBSD: to.c,v 1.27 2016/05/22 11:15:31 gilles Exp $ */
/*
* Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@@ -194,21 +194,26 @@ time_to_text(time_t when)
char *day[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
char *month[] = {"Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"};
+ char *tz;
+ long offset;
lt = localtime(&when);
if (lt == NULL || when == 0)
fatalx("time_to_text: localtime");
+ offset = lt->tm_gmtoff;
+ tz = lt->tm_zone;
+
/* We do not use strftime because it is subject to locale substitution*/
if (!bsnprintf(buf, sizeof(buf),
"%s, %d %s %d %02d:%02d:%02d %c%02d%02d (%s)",
day[lt->tm_wday], lt->tm_mday, month[lt->tm_mon],
lt->tm_year + 1900,
lt->tm_hour, lt->tm_min, lt->tm_sec,
- lt->tm_gmtoff >= 0 ? '+' : '-',
- abs((int)lt->tm_gmtoff / 3600),
- abs((int)lt->tm_gmtoff % 3600) / 60,
- lt->tm_zone))
+ offset >= 0 ? '+' : '-',
+ abs((int)offset / 3600),
+ abs((int)offset % 3600) / 60,
+ tz))
fatalx("time_to_text: bsnprintf");
return buf;