* lib/group-member.c: Include intprops.h.
(get_group_info): Use INT_MULTIPLY_WRAPV instead of
xalloc_oversized (which does a multiplication) followed by the
same multiplication. The code was OK as-is; this is just
conceptual simplification, possible now that we have xalloc_count_t.
* modules/group-member: Depend on intprops.
2021-04-06 Paul Eggert <eggert@cs.ucla.edu>
+ group-member: minor tweak to omit a *
+ * lib/group-member.c: Include intprops.h.
+ (get_group_info): Use INT_MULTIPLY_WRAPV instead of
+ xalloc_oversized (which does a multiplication) followed by the
+ same multiplication. The code was OK as-is; this is just
+ conceptual simplification, possible now that we have xalloc_count_t.
+ * modules/group-member: Depend on intprops.
+
backupfile: less-aggressive buffer growth
* lib/backupfile.c: Include intprops.h.
(numbered_backup): Grow buffer by the usual 50%, not 100%.
#include <sys/types.h>
#include <stdlib.h>
+#include "intprops.h"
#include "xalloc-oversized.h"
/* Most processes have no more than this many groups, and for these
if (n_groups < 0)
{
int n_group_slots = getgroups (0, NULL);
+ xalloc_count_t nbytes;
if (0 <= n_group_slots
- && ! xalloc_oversized (n_group_slots, sizeof *gi->group))
+ && ! INT_MULTIPLY_WRAPV (n_group_slots, sizeof *gi->group, &nbytes))
{
- gi->group = malloc (n_group_slots * sizeof *gi->group);
+ gi->group = malloc (nbytes);
if (gi->group)
n_groups = getgroups (n_group_slots, gi->group);
}
unistd
extensions
getgroups [test $HAVE_GROUP_MEMBER = 0]
+intprops [test $HAVE_GROUP_MEMBER = 0]
xalloc-oversized [test $HAVE_GROUP_MEMBER = 0]
configure.ac: