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