summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorJim Meyering1997-12-10 11:31:25 +0100
committerJim Meyering1997-12-10 11:31:25 +0100
commit3c35aec120bf667472d4bd9b61dbed954e263b58 (patch)
treeb0697d2e9bbf288669a0e3b1e2d9cedcf18ce3b5 /login-utils
parent(main): Make sure pw->pw_shell is non-NULL before trying to strdup it. (diff)
downloadkernel-qcow2-util-linux-3c35aec120bf667472d4bd9b61dbed954e263b58.tar.gz
kernel-qcow2-util-linux-3c35aec120bf667472d4bd9b61dbed954e263b58.tar.xz
kernel-qcow2-util-linux-3c35aec120bf667472d4bd9b61dbed954e263b58.zip
use NULL, '\0' instead of zeroes
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/su.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/login-utils/su.c b/login-utils/su.c
index dda02fe09..bd3c5b808 100644
--- a/login-utils/su.c
+++ b/login-utils/su.c
@@ -530,8 +530,10 @@ main (int argc, char **argv)
error (1, 0, _("user %s does not exist"), new_user);
endpwent ();
- /* make sure pw->pw_shell is non-zero */
- if (pw->pw_shell == 0 || pw->pw_shell[0] == 0)
+ /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
+ is a username that is retrieved via NIS (YP), but that doesn't have
+ a default shell listed. */
+ if (pw->pw_shell == NULL || pw->pw_shell[0] == '\0')
pw->pw_shell = (char *) DEFAULT_SHELL;
/* Make a copy of the password information and point pw at the local