about summary refs log tree commit diff
path: root/pwd/fgetpwent_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'pwd/fgetpwent_r.c')
-rw-r--r--pwd/fgetpwent_r.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/pwd/fgetpwent_r.c b/pwd/fgetpwent_r.c
index 9b58e61009..bd380bd48c 100644
--- a/pwd/fgetpwent_r.c
+++ b/pwd/fgetpwent_r.c
@@ -32,8 +32,16 @@ LINE_PARSER
 (,
  STRING_FIELD (result->pw_name, ISCOLON, 0);
  STRING_FIELD (result->pw_passwd, ISCOLON, 0);
- INT_FIELD (result->pw_uid, ISCOLON, 0, 10,);
- INT_FIELD (result->pw_gid, ISCOLON, 0, 10,);
+ if (result->pw_name[0] == '+' || result->pw_name[0] == '-')
+   {
+     INT_FIELD_MAYBE_NULL (result->pw_uid, ISCOLON, 0, 10, , 0)
+     INT_FIELD_MAYBE_NULL (result->pw_gid, ISCOLON, 0, 10, , 0)
+   }
+ else
+   {
+     INT_FIELD (result->pw_uid, ISCOLON, 0, 10,)
+     INT_FIELD (result->pw_gid, ISCOLON, 0, 10,)
+   }
  STRING_FIELD (result->pw_gecos, ISCOLON, 0);
  STRING_FIELD (result->pw_dir, ISCOLON, 0);
  result->pw_shell = line;