summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slstatus.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/slstatus.c b/slstatus.c
index 7b85a23..3675660 100644
--- 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 *