user: Only declare variables in the beginning
Aaron Marcher me@drkhsh.at
Wed, 02 May 2018 08:42:55 +0200
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
components/user.c
→
components/user.c
@@ -17,9 +17,9 @@
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; }