From 530ff00378e7fc235e5ea51067c77398d575141e Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 30 Oct 2012 08:00:53 +0000 Subject: Teach pw(8) about how to use pw/gr API to reduce code duplication MFC after: 2 months --- pw/pw_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pw/pw_log.c') diff --git a/pw/pw_log.c b/pw/pw_log.c index fc85828..f16274f 100644 --- a/pw/pw_log.c +++ b/pw/pw_log.c @@ -51,7 +51,7 @@ pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...) 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"; -- cgit v1.2.3-56-ge451 From 6a8e8e9417ba3b80124f0e102f7794e9b0bdb680 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Wed, 16 Jan 2013 05:03:49 +0000 Subject: Remove unused variables Approved by: cperciva MFC After: 3 days --- pw/pw_log.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'pw/pw_log.c') diff --git a/pw/pw_log.c b/pw/pw_log.c index f16274f..b774423 100644 --- a/pw/pw_log.c +++ b/pw/pw_log.c @@ -47,7 +47,6 @@ 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]; @@ -57,7 +56,6 @@ pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...) 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); -- cgit v1.2.3-56-ge451