]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sulogin: do not use plain 0 as NULL
authorKarel Zak <kzak@redhat.com>
Thu, 16 Aug 2018 13:58:20 +0000 (15:58 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 16 Aug 2018 13:58:20 +0000 (15:58 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/sulogin.c

index 49b949a904c25e00722d6645f70682c3b67f4ac0..78a01f4328ff975b3f15f0ca435eeb0978f3f805 100644 (file)
@@ -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;