From 73d462c847c7621e03b0451578ebe6f2ead0950d Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Tue, 13 Sep 2016 22:47:16 +0200 Subject: [PATCH] utmp_set(): Fix uninitialized return value Signed-off-by: Joachim Nilsson --- utmp-api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utmp-api.c b/utmp-api.c index c247eb9d..87dd8c80 100644 --- a/utmp-api.c +++ b/utmp-api.c @@ -42,7 +42,7 @@ static void utmp_strncpy(char *dst, const char *src, size_t dlen) int utmp_set(int type, int pid, char *line, char *id, char *user) { - int result; + int result = 0; struct utmp ut; struct utsname uts; @@ -72,7 +72,7 @@ int utmp_set(int type, int pid, char *line, char *id, char *user) if (type != DEAD_PROCESS) { setutent(); - result = pututline(&ut) ? 0 : 1;; + result += pututline(&ut) ? 0 : 1; endutent(); } updwtmp(_PATH_WTMP, &ut);