]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - libc/gen/pw_scan.c
add missing endusershell() call. Original version was incorrect.
[pw-darwin.git] / libc / gen / pw_scan.c
index e785511d2cae0c66f2b908ba882a036f24c38c2a..04cc388c8210a8bd0cbd13534923391f6d4a64e8 100644 (file)
@@ -180,7 +180,7 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
                goto fmt;
 
        p = pw->pw_shell;
-       if (root && *p)                                 /* empty == /bin/sh */
+       if (root && *p) {                               /* empty == /bin/sh */
                for (setusershell();;) {
                        if (!(sh = getusershell())) {
                                if (flags & _PWSCAN_WARN)
@@ -190,6 +190,8 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
                        if (!strcmp(p, sh))
                                break;
                }
+               endusershell();
+       }
        if (p[0])
                pw->pw_fields |= _PWF_SHELL;