about summary refs log tree commit diff
path: root/shadow/fgetspent_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'shadow/fgetspent_r.c')
-rw-r--r--shadow/fgetspent_r.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/shadow/fgetspent_r.c b/shadow/fgetspent_r.c
index 6521517a6f..0cdcc76d9b 100644
--- a/shadow/fgetspent_r.c
+++ b/shadow/fgetspent_r.c
@@ -32,8 +32,9 @@ struct spent_data {};
 
 
 /* Read one shadow entry from the given stream.  */
-struct spwd *
-__fgetspent_r (FILE *stream, struct spwd *result, char *buffer, int buflen)
+int
+__fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
+	       struct spwd **result)
 {
   char *p;
 
@@ -41,7 +42,7 @@ __fgetspent_r (FILE *stream, struct spwd *result, char *buffer, int buflen)
     {
       p = fgets (buffer, buflen, stream);
       if (p == NULL)
-	return NULL;
+	return errno;
 
       /* Skip leading blanks.  */
       while (isspace (*p))
@@ -49,8 +50,9 @@ __fgetspent_r (FILE *stream, struct spwd *result, char *buffer, int buflen)
     } while (*p == '\0' || *p == '#' ||	/* Ignore empty and comment lines.  */
 	     /* Parse the line.  If it is invalid, loop to
 		get the next line of the file to parse.  */
-	     ! parse_line (buffer, (void *) result, NULL, 0));
+	     ! parse_line (buffer, (void *) resbuf, NULL, 0));
 
-  return result;
+  *result = resbuf;
+  return 0;
 }
 weak_alias (__fgetspent_r, fgetspent_r)