From e4c67052ef99dc8a10e3f707ca78cc3f01b02c6f Mon Sep 17 00:00:00 2001 From: Petar Kapris Date: Wed, 25 Nov 2020 19:04:56 +0100 Subject: [PATCH] Change ut_list_p variable from global to local The variable ut_list_p, is used in two seperate functions, read_wtmp() and free_wtmp(), it's state isn't preserved, nor is it important, therefore it's cleaner to simply use two local variables in each function, rather than one global variable, used across both. --- timeoutd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/timeoutd.c b/timeoutd.c index 1d6c175..6fac1ce 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -165,7 +165,6 @@ struct ut_list { }; struct ut_list *wtmplist = (struct ut_list *) NULL; -struct ut_list *ut_list_p; struct time_ent { int days; @@ -388,6 +387,7 @@ void read_wtmp() { FILE *fp; struct utmp ut; + struct ut_list *ut_list_p; struct tm *tm; #ifdef DEBUG @@ -445,6 +445,7 @@ void read_wtmp() void free_wtmp() { + struct ut_list *ut_list_p; #ifdef DEBUG openlog("timeoutd", OPENLOG_FLAGS, LOG_DAEMON); syslog(SYSLOG_DEBUG, "Freeing list of today's wtmp entries.");