summaryrefslogtreecommitdiffstats
path: root/pw/pw_log.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2013-06-19 11:36:13 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2013-06-19 11:36:13 +0000
commit92ca6ea990f50c4c8bd3c485bcb54646a590f0ba (patch)
treefd105835d2f614bac3c24fd429fa3bea8f98ef8c /pw/pw_log.c
parent1d39c9328d1f55897e016da0574741cf289c9424 (diff)
parent6e958ef1b49b6a86d2c9a1fd68f98f9e84842aaa (diff)
downloadpw-darwin-92ca6ea990f50c4c8bd3c485bcb54646a590f0ba.tar.gz
pw-darwin-92ca6ea990f50c4c8bd3c485bcb54646a590f0ba.tar.zst
pw-darwin-92ca6ea990f50c4c8bd3c485bcb54646a590f0ba.zip
Merge fresh head.
Diffstat (limited to 'pw/pw_log.c')
-rw-r--r--pw/pw_log.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/pw/pw_log.c b/pw/pw_log.c
index fc85828..b774423 100644
--- a/pw/pw_log.c
+++ b/pw/pw_log.c
@@ -47,17 +47,15 @@ pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...)
}
if (logfile != NULL) {
va_list argp;
- int l;
time_t now = time(NULL);
struct tm *t = localtime(&now);
char nfmt[256];
- char *name;
+ const char *name;
if ((name = getenv("LOGNAME")) == NULL && (name = getenv("USER")) == NULL)
name = "unknown";
/* ISO 8601 International Standard Date format */
strftime(nfmt, sizeof nfmt, "%Y-%m-%d %T ", t);
- l = strlen(nfmt);
sprintf(nfmt + strlen(nfmt), "[%s:%s%s] %s\n", name, Which[which], Modes[mode], fmt);
va_start(argp, fmt);
vfprintf(logfile, nfmt, argp);