X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fsetuid.c;h=3ac78e4fa2fb62262537b5fb2d66c93f041e4780;hb=c85f503f5793839a6be4c818332aca4a96927bb2;hp=74d8318b8ea1860b7119949f5b2b861c77e69592;hpb=3f438031d610c7e15fd33876a879b97e290e05fb;p=xscreensaver diff --git a/driver/setuid.c b/driver/setuid.c index 74d8318b..3ac78e4f 100644 --- a/driver/setuid.c +++ b/driver/setuid.c @@ -93,11 +93,13 @@ static int setgroups_needed_p (uid_t target_group) { gid_t groups[1024]; - int n = getgroups (sizeof(groups)-1, groups); + int n, size; + size = sizeof(groups) / sizeof(gid_t); + n = getgroups (size - 1, groups); if (n < 0) { char buf [1024]; - sprintf (buf, "%s: getgroups(%d, ...)", blurb(), sizeof(groups)-1); + sprintf (buf, "%s: getgroups(%ld, ...)", blurb(), (long int)(size - 1)); perror (buf); return 1; } @@ -161,7 +163,7 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) { char buf [1024]; gid_t groups[1024]; - int n; + int n, size; if (sgs_errno) { @@ -178,7 +180,8 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) } fprintf (stderr, "%s: effective group list: ", blurb()); - n = getgroups (sizeof(groups)-1, groups); + size = sizeof(groups) / sizeof(gid_t); + n = getgroups (size - 1, groups); if (n < 0) fprintf (stderr, "unknown!\n"); else