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) {
|
if(owner && *owner) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pw = getpwnam(owner);
|
pw = getpwnam(owner);
|
||||||
if(errno == -1)
|
if(errno != 0)
|
||||||
eprintf("getpwnam %s:", owner);
|
eprintf("getpwnam %s:", owner);
|
||||||
else if(!pw)
|
else if(!pw)
|
||||||
eprintf("getpwnam %s: no such user\n", owner);
|
eprintf("getpwnam %s: no such user\n", owner);
|
||||||
|
@ -45,7 +45,7 @@ main(int argc, char *argv[])
|
||||||
if(group && *group) {
|
if(group && *group) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
gr = getgrnam(group);
|
gr = getgrnam(group);
|
||||||
if(errno == -1)
|
if(errno != 0)
|
||||||
eprintf("getgrnam %s:", group);
|
eprintf("getgrnam %s:", group);
|
||||||
else if(!gr)
|
else if(!gr)
|
||||||
eprintf("getgrnam %s: no such group\n", group);
|
eprintf("getgrnam %s: no such group\n", group);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user