X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/faa52bdcc0221de2d8fae950e409a8ac5e05bfcd..1fc5cf00166a5dfefa89c3d6abbe92fedaf71e27:/components/user.c?ds=inline 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; }