fix errno
This commit is contained in:
parent
d90ced2047
commit
ea7563dc0b
4
chown.c
4
chown.c
|
@ -37,7 +37,7 @@ main(int argc, char *argv[])
|
|||
if(owner && *owner) {
|
||||
errno = 0;
|
||||
pw = getpwnam(owner);
|
||||
if(errno == -1)
|
||||
if(errno != 0)
|
||||
eprintf("getpwnam %s:", owner);
|
||||
else if(!pw)
|
||||
eprintf("getpwnam %s: no such user\n", owner);
|
||||
|
@ -45,7 +45,7 @@ main(int argc, char *argv[])
|
|||
if(group && *group) {
|
||||
errno = 0;
|
||||
gr = getgrnam(group);
|
||||
if(errno == -1)
|
||||
if(errno != 0)
|
||||
eprintf("getgrnam %s:", group);
|
||||
else if(!gr)
|
||||
eprintf("getgrnam %s: no such group\n", group);
|
||||
|
|
Loading…
Reference in New Issue
Block a user