bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Problem w/ getgroups in Gawk 3.1.1 on Ultrix


From: Aharon Robbins
Subject: Re: Problem w/ getgroups in Gawk 3.1.1 on Ultrix
Date: Mon, 13 May 2002 00:45:37 +0300

Greetings. Re this:

> From: Bert Deknuydt <address@hidden>
> Date: Fri, 10 May 2002 16:14:13 +0200
> To: address@hidden
> Subject: Problem w/ getgroups in Gawk 3.1.1 on Ultrix
>
> Hello,
>
> I found the following problem with the most recent Gawk on Ultrix (mips and
> vax).
>
> On Ultrix, the getgroups() function does not conform to the standards and
> returns '-1' if it's given (0,NULL) as arguments.  In fact, it continues to
> return errors, unless the array is large enough to store all gid's.
> Hence, gawk 3.1.1 always complains about "could not find groups:".  
>
> I'd see two solutions ... 1) Somehow arrange HAVE_GETGROUPS to be false for
> a nonconform getgroups(), 2) modify perfectly correct code ...
>
> Greetings, Bert.

Thanks for the report. I think that the following patch fixes the problem.

Arnold
---------------------------------------------
Mon May 13 00:41:31 2002  Arnold D. Robbins  <address@hidden>

        * custom.h (ultrix): Add define GETGROUPS_NOT_STANDARD.
        * main.c (init_groupset): For GETGROUPS_NOT_STANDARD, use old way
        to set `ngroups'.

*** ../gawk-3.1.1/custom.h      Tue Apr 16 14:40:47 2002
--- custom.h    Mon May 13 00:41:04 2002
***************
*** 83,88 ****
--- 83,89 ----
  /* For ULTRIX 4.3 */
  #ifdef ultrix
  #define HAVE_MKTIME     1
+ #define GETGROUPS_NOT_STANDARD        1
  #endif
  
  /* For whiny users */
*** ../gawk-3.1.1/main.c        Wed May  1 17:12:45 2002
--- main.c      Mon May 13 00:40:26 2002
***************
*** 1028,1038 ****
--- 1029,1044 ----
  init_groupset()
  {
  #if defined(HAVE_GETGROUPS) && defined(NGROUPS_MAX) && NGROUPS_MAX > 0
+ #ifdef GETGROUPS_NOT_STANDARD
+       /* For systems that aren't standards conformant, use old way. */
+       ngroups = NGROUPS_MAX;
+ #else
        /*
         * If called with 0 for both args, return value is
         * total number of groups.
         */
        ngroups = getgroups(0, NULL);
+ #endif
        if (ngroups == -1)
                fatal(_("could not find groups: %s"), strerror(errno));
        else if (ngroups == 0)



reply via email to

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