diff options
Diffstat (limited to 'grp')
-rw-r--r-- | grp/fgetgrent.c | 9 | ||||
-rw-r--r-- | grp/tst_fgetgrent.c | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c index d2e3de69a7..245524f178 100644 --- a/grp/fgetgrent.c +++ b/grp/fgetgrent.c @@ -52,8 +52,8 @@ fgetgrent (FILE *stream) } while (buffer != NULL - && __fgetgrent_r (stream, &resbuf, buffer, buffer_size, &result) != 0 - && errno == ERANGE) + && (__fgetgrent_r (stream, &resbuf, buffer, buffer_size, &result) + == ERANGE)) { char *new_buf; buffer_size += NSS_BUFLEN_GROUP; @@ -70,10 +70,7 @@ fgetgrent (FILE *stream) /* Reset the stream. */ if (fsetpos (stream, &pos) != 0) - { - buffer = NULL; - break; - } + buffer = NULL; } if (buffer == NULL) diff --git a/grp/tst_fgetgrent.c b/grp/tst_fgetgrent.c index 2790f2d1d6..79331f72d5 100644 --- a/grp/tst_fgetgrent.c +++ b/grp/tst_fgetgrent.c @@ -32,9 +32,12 @@ write_users (FILE *f, int large_pos, int pos) if (pos == large_pos) { + if (large_pos == 3) + fprintf (f, ":three"); + /* we need more than 2048 bytes for proper testing. */ for (i = 0; i < 500; i++) - fprintf (f, "%suser%03d", i == 0 ? ":" : ",", i); + fprintf (f, ",user%03d", i); } fprintf (f, "\n"); |