wall: check -g GID
Based on comments from Sami Kerola. Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
b439065634
commit
e0383e3e88
|
@ -19,7 +19,7 @@ _wall_module()
|
|||
esac
|
||||
case $cur in
|
||||
-*)
|
||||
OPTS="--nobanner --timeout --version --help"
|
||||
OPTS="--group --nobanner --timeout --version --help"
|
||||
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
|
|
|
@ -109,10 +109,16 @@ struct group_workspace {
|
|||
static gid_t get_group_gid(const char *optarg)
|
||||
{
|
||||
struct group *gr;
|
||||
gid_t gid;
|
||||
|
||||
if ((gr = getgrnam(optarg)))
|
||||
return gr->gr_gid;
|
||||
return strtou64_or_err(optarg, _("invalid group argument"));
|
||||
|
||||
gid = strtou32_or_err(optarg, _("invalid group argument"));
|
||||
if (!getgrgid(gid))
|
||||
errx(EXIT_FAILURE, _("%s: unknown gid"), optarg);
|
||||
|
||||
return gid;
|
||||
}
|
||||
|
||||
static struct group_workspace *init_group_workspace(const char *optarg)
|
||||
|
|
Loading…
Reference in New Issue