Xinqi Bao's Git
projects
/
slstatus.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
| inline |
side by side
(parent:
98f3985
)
fixed username function (wtf happened here?)
author
Aaron Marcher <
[email protected]
>
Fri, 9 Sep 2016 17:19:46 +0000
(19:19 +0200)
committer
Aaron Marcher (drkhsh) <
[email protected]
>
Fri, 9 Sep 2016 17:19:46 +0000
(19:19 +0200)
slstatus.c
diff
|
blob
|
history
diff --git
a/slstatus.c
b/slstatus.c
index
7b85a23
..
3675660
100644
(file)
--- a/
slstatus.c
+++ b/
slstatus.c
@@
-455,11
+455,12
@@
username(void)
uid_t uid = geteuid();
struct passwd *pw = getpwuid(uid);
- if (pw == NULL)
- return smprintf("%s", pw->pw_name);
+ if (pw == NULL) {
+ warn("Could not get username");
+ return smprintf(UNKNOWN_STR);
+ }
- warn("Could not get username");
- return smprintf(UNKNOWN_STR);
+ return smprintf("%s", pw->pw_name);
}
static char *