summaryrefslogtreecommitdiffstats
path: root/term-utils/wall.c
diff options
context:
space:
mode:
authorKarel Zak2017-06-14 11:53:43 +0200
committerKarel Zak2017-06-14 11:53:43 +0200
commit098a75a18b3a8e2c6adc72a5e574b796435ee6cd (patch)
treea12e679ad60bc37c7ad71817de78248aaccfe330 /term-utils/wall.c
parentmisc: POSIX usage dd, regarding unit suffixes (diff)
downloadkernel-qcow2-util-linux-098a75a18b3a8e2c6adc72a5e574b796435ee6cd.tar.gz
kernel-qcow2-util-linux-098a75a18b3a8e2c6adc72a5e574b796435ee6cd.tar.xz
kernel-qcow2-util-linux-098a75a18b3a8e2c6adc72a5e574b796435ee6cd.zip
wall: fix OSX getgrouplist, gid_t* vs int*
This was the compiler warning: term-utils/wall.c:156:39: warning: passing 'gid_t *const' (aka 'unsigned int *const') to parameter of type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign] rc = getgrouplist(login, pw->pw_gid, buf->groups, &ngroups); ^~~~~~~~~~~ /usr/include/unistd.h:653:43: note: passing argument to parameter here int getgrouplist(const char *, int, int *, int *); ^ Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> 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 a9dde15be..44f9d5879 100644
--- a/term-utils/wall.c
+++ b/term-utils/wall.c
@@ -102,7 +102,13 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
struct group_workspace {
gid_t requested_group;
int ngroups;
+
+/* getgrouplist() on OSX takes int* not gid_t* */
+#ifdef __APPLE__
+ int *groups;
+#else
gid_t *groups;
+#endif
};
static gid_t get_group_gid(const char *optarg)
@@ -162,7 +168,7 @@ static int is_gr_member(const char *login, const struct group_workspace *buf)
}
for (; ngroups >= 0; --ngroups) {
- if (buf->requested_group == buf->groups[ngroups])
+ if (buf->requested_group == (gid_t) buf->groups[ngroups])
return 1;
}