summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2018-08-16 15:58:20 +0200
committerKarel Zak2018-08-16 15:58:20 +0200
commitf9915d6db350d7633aecb1ed2ba764ce4fda6fd6 (patch)
tree782a6054dd5274cc5b6b06e811be934a83f84e13 /login-utils
parentlibmount: cleanup licenses sections in the files (diff)
downloadkernel-qcow2-util-linux-f9915d6db350d7633aecb1ed2ba764ce4fda6fd6.tar.gz
kernel-qcow2-util-linux-f9915d6db350d7633aecb1ed2ba764ce4fda6fd6.tar.xz
kernel-qcow2-util-linux-f9915d6db350d7633aecb1ed2ba764ce4fda6fd6.zip
sulogin: do not use plain 0 as NULL
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/sulogin.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index 49b949a90..78a01f432 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -520,8 +520,9 @@ static void doprompt(const char *crypted, struct console *con, int deny)
tty.c_oflag |= (ONLCR | OPOST);
tcsetattr(con->fd, TCSADRAIN, &tty);
}
- if (con->file == (FILE*)0) {
- if ((con->file = fdopen(con->fd, "r+")) == (FILE*)0)
+ if (!con->file) {
+ con->file = fdopen(con->fd, "r+");
+ if (!con->file)
goto err;
}
@@ -643,7 +644,7 @@ static const char *getpasswd(struct console *con)
xusleep(250000);
continue;
}
- ret = (char*)0;
+ ret = NULL;
switch (errno) {
case 0:
case EIO:
@@ -695,7 +696,7 @@ static const char *getpasswd(struct console *con)
default:
if ((size_t)(ptr - &pass[0]) >= (sizeof(pass) -1 )) {
fprintf(stderr, "sulogin: input overrun at %s\n\r", con->tty);
- ret = (char*)0;
+ ret = NULL;
goto quit;
}
*ptr++ = ascval;