]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - libc/gen/pw_scan.c
Don't forget to '\n'-terminate new entries. This unbreaks chpass -a.
[pw-darwin.git] / libc / gen / pw_scan.c
index 3d49aa88be8f38e938259df48c62f2f588627810..e785511d2cae0c66f2b908ba882a036f24c38c2a 100644 (file)
@@ -124,6 +124,13 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
                goto fmt;
        if (p[0])
                pw->pw_fields |= _PWF_GID;
+       else {
+               if (pw->pw_name[0] != '+' && pw->pw_name[0] != '-') {
+                       if (flags & _PWSCAN_WARN)
+                               warnx("no gid for user %s", pw->pw_name);
+                       return (0);
+               }
+       }
        id = strtoul(p, &ep, 10);
        if (errno == ERANGE) {
                if (flags & _PWSCAN_WARN)