about summary refs log tree commit diff
path: root/grp/fgetgrent.c
diff options
context:
space:
mode:
Diffstat (limited to 'grp/fgetgrent.c')
-rw-r--r--grp/fgetgrent.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/grp/fgetgrent.c b/grp/fgetgrent.c
index 95ae2ecd6a..66dd305b0b 100644
--- a/grp/fgetgrent.c
+++ b/grp/fgetgrent.c
@@ -25,7 +25,11 @@ struct group *
 fgetgrent (FILE *stream)
 {
   static char buffer[BUFSIZ];
-  static struct group result;
+  static struct group resbuf;
+  struct group *result;
 
-  return __fgetgrent_r (stream, &result, buffer, sizeof buffer);
+  if (__fgetgrent_r (stream, &resbuf, buffer, sizeof buffer, &result) != 0)
+    return NULL;
+
+  return result;
 }