bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pending patches?


From: Jim Meyering
Subject: Re: pending patches?
Date: Fri, 13 Nov 2009 21:22:47 +0100

Eric Blake wrote:
> According to Eric Blake on 11/13/2009 11:35 AM:
>> I also discovered that
>> FreeBSD getgroups(-1,NULL) fails with EFAULT instead of EINVAL, which
>> means that it mistakenly populates a valid pointer rather than rejecting a
>> negative argument; should be easy to fix today.
>
> Like so.  And I feel silly for the buffer overrun in the test; I was
> originally using xnmalloc, but didn't want drag in "xalloc.h" for the
> test, but converted it wrong.
...
> Subject: [PATCH] getgroups: work around FreeBSD bug
>
> FreeBSD 7.2 mistakenly succeeds on getgroups(-1,ptr) (POSIX
> requires EINVAL failure since -1 is less than the proper result).
>
> * lib/getgroups.c (rpl_getgroups): Work around the bug.
> * m4/getgroups.m4 (gl_FUNC_GETGROUPS): Detect the bug.
> * doc/posix-functions/getgroups.texi (getgroups): Document it.
> * tests/test-getgroups.c (main): Fix buffer overrun.

The patch looks fine.

For some reason (probably due to the dichotomy of success/failure
in shell vs. true/false in C) I alway have to stare hard at code
like this to be sure the returned expression is not reversed:

  +      [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  +        [[int size = getgroups (0, 0);
  +          gid_t *list = malloc (size * sizeof *list);
  +          return getgroups (-1, list) != -1;]])],
  +        [gl_cv_func_getgroups_works=yes],
  +        [gl_cv_func_getgroups_works=no],
  +        [gl_cv_func_getgroups_works="guessing no"])])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]