summaryrefslogtreecommitdiffstats
path: root/term-utils/wall.c
diff options
context:
space:
mode:
authorKarel Zak2016-12-02 14:11:20 +0100
committerKarel Zak2016-12-02 14:11:20 +0100
commite0383e3e88f4d80454bb67b4e8920126c667d258 (patch)
treee225bd55b780471b64da11dbf0357b6ca8bc1878 /term-utils/wall.c
parentfallocate: add insert range support (diff)
downloadkernel-qcow2-util-linux-e0383e3e88f4d80454bb67b4e8920126c667d258.tar.gz
kernel-qcow2-util-linux-e0383e3e88f4d80454bb67b4e8920126c667d258.tar.xz
kernel-qcow2-util-linux-e0383e3e88f4d80454bb67b4e8920126c667d258.zip
wall: check -g GID
Based on comments from Sami Kerola. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/wall.c')
-rw-r--r--term-utils/wall.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/term-utils/wall.c b/term-utils/wall.c
index 7eee88c90..2c1697c3b 100644
--- a/term-utils/wall.c
+++ b/term-utils/wall.c
@@ -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)