From 709549b4bd9fee0e0054c0dfa75fff9ac18f2862 Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Wed, 2 May 2018 08:42:55 +0200 Subject: user: Only declare variables in the beginning --- components/user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/user.c') diff --git a/components/user.c b/components/user.c index b335dc3..8ab6db9 100644 --- a/components/user.c +++ b/components/user.c @@ -17,9 +17,9 @@ gid(void) const char * username(void) { - struct passwd *pw = getpwuid(geteuid()); + struct passwd *pw; - if (pw == NULL) { + if (!(pw = getpwuid(geteuid()))) { fprintf(stderr, "getpwuid '%d': %s\n", geteuid(), strerror(errno)); return NULL; } -- cgit v1.2.3