From: Karel Zak Date: Thu, 16 Aug 2018 13:58:20 +0000 (+0200) Subject: sulogin: do not use plain 0 as NULL X-Git-Tag: v2.33-rc1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9915d6db350d7633aecb1ed2ba764ce4fda6fd6;p=thirdparty%2Futil-linux.git sulogin: do not use plain 0 as NULL Signed-off-by: Karel Zak --- diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c index 49b949a904..78a01f4328 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;