do not complain when negating selection if we can't find a user/group
This commit is contained in:
parent
c5ee091e4c
commit
c29ce7be61
16
ps/parser.c
16
ps/parser.c
@ -95,10 +95,14 @@ static const char *parse_uid(char *str, sel_union *ret){
|
|||||||
num = strtoul(str, &endp, 0);
|
num = strtoul(str, &endp, 0);
|
||||||
if(*endp != '\0'){ /* hmmm, try as login name */
|
if(*endp != '\0'){ /* hmmm, try as login name */
|
||||||
passwd_data = getpwnam(str);
|
passwd_data = getpwnam(str);
|
||||||
if(!passwd_data) return _("user name does not exist");
|
if(!passwd_data){
|
||||||
|
if(!negate_selection) return _("user name does not exist");
|
||||||
|
num = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
num = passwd_data->pw_uid;
|
num = passwd_data->pw_uid;
|
||||||
}
|
}
|
||||||
if(num > 0xfffffffeUL) return _("user ID out of range");
|
if(!negate_selection && (num > 0xfffffffeUL)) return _("user ID out of range");
|
||||||
ret->uid = num;
|
ret->uid = num;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -110,10 +114,14 @@ static const char *parse_gid(char *str, sel_union *ret){
|
|||||||
num = strtoul(str, &endp, 0);
|
num = strtoul(str, &endp, 0);
|
||||||
if(*endp != '\0'){ /* hmmm, try as login name */
|
if(*endp != '\0'){ /* hmmm, try as login name */
|
||||||
group_data = getgrnam(str);
|
group_data = getgrnam(str);
|
||||||
if(!group_data) return _("group name does not exist");
|
if(!group_data){
|
||||||
|
if(!negate_selection) return _("group name does not exist");
|
||||||
|
num = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
num = group_data->gr_gid;
|
num = group_data->gr_gid;
|
||||||
}
|
}
|
||||||
if(num > 0xfffffffeUL) return _("group ID out of range");
|
if(!negate_selection && (num > 0xfffffffeUL)) return _("group ID out of range");
|
||||||
ret->gid = num;
|
ret->gid = num;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user