[hackers] [slstatus] user: Only declare variables in the beginning || Aaron Marcher

From: <git_AT_suckless.org>
Date: Wed, 2 May 2018 08:49:38 +0200 (CEST)

commit 709549b4bd9fee0e0054c0dfa75fff9ac18f2862
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Wed May 2 08:42:55 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Wed May 2 08:42:55 2018 +0200

    user: Only declare variables in the beginning

diff --git a/components/user.c b/components/user.c
index b335dc3..8ab6db9 100644
--- a/components/user.c
+++ b/components/user.c
_AT_@ -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;
         }
Received on Wed May 02 2018 - 08:49:38 CEST

This archive was generated by hypermail 2.3.0 : Wed May 02 2018 - 09:00:55 CEST