user: Only declare variables in the beginning
This commit is contained in:
parent
e43c3a16f0
commit
709549b4bd
1 changed files with 2 additions and 2 deletions
|
@ -17,9 +17,9 @@ gid(void)
|
||||||
const char *
|
const char *
|
||||||
username(void)
|
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));
|
fprintf(stderr, "getpwuid '%d': %s\n", geteuid(), strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue