Bug 90531 - getgrent desn't set errno variable
getgrent desn't set errno variable
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
9
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-05-09 09:23 EDT by Vaclav Danhelka
Modified: 2016-11-24 10:06 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-06-09 23:33:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Vaclav Danhelka 2003-05-09 09:23:05 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MSNATLAS01)

Description of problem:
Getgrent doesn't set errno variable on Redhat 9. For this reason it is not 
possible to run IBM WebSphere MQSeries software on Redhat 9, because MQ 
commands enters infinite loop during /etc/group checking.


Version-Release number of selected component (if applicable):
glibc-2.3.2-27.9

How reproducible:
Always

Steps to Reproduce:
1.Run sample program.
2.
3.
    

Actual Results:  RC=0

Expected Results:  RC=2

Additional info:

#include <stdio.h>
#include <stdlib.h>
#include <grp.h>
#include <sys/types.h>
#include <errno.h>

int main(void)
{
        struct group * g;
        setgrent();
        while(1)
        {
                g = getgrent();
                if(!g)
                {
                        printf("RC = %d\n",errno);
                        break;
                }
                printf("%s: %d\n",g->gr_name,g->gr_gid);
        }

}
Comment 1 Ulrich Drepper 2003-06-09 23:33:54 EDT
Read POSIX:

The getgrent() function shall return a null pointer on end-of-file or an error
and errno may be set to indicate the error.

The key word is "may".  You cannot rely on this.  Fix your code.

Note You need to log in before you can comment on or make changes to this bug.