]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sulogin: fix compiler warnings
authorKarel Zak <kzak@redhat.com>
Wed, 17 Apr 2013 15:23:26 +0000 (17:23 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 17 Apr 2013 15:23:26 +0000 (17:23 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/sulogin-consoles.c

index 305d1e7dccde33f8c59516fd5af7a0e9c06248b7..d0f0eab2be768b2e7a299d49c288b62a95f1cbd9 100644 (file)
@@ -507,11 +507,11 @@ done:
        return rc;
 }
 
+#ifdef TIOCGDEV
 static int detect_consoles_from_tiocgdev(struct list_head *consoles,
                                        int fallback,
                                        const char *device)
 {
-#ifdef TIOCGDEV
        unsigned int devnum;
        char *name;
        int rc = 1, fd = -1;
@@ -566,9 +566,8 @@ done:
                close(fd);
        DBG(dbgprint("[tiocgdev rc=%d]", rc));
        return rc;
-#endif
-       return 2;
 }
+#endif /* TIOCGDEV */
 #endif /* __linux__ */
 
 /*
@@ -704,12 +703,13 @@ console:
         * Detection of the device used for Linux system console using
         * the ioctl TIOCGDEV if available (e.g. official 2.6.38).
         */
+#ifdef TIOCGDEV
        rc = detect_consoles_from_tiocgdev(consoles, fallback, device);
        if (rc == 0)
                return reconnect;       /* success */
        if (rc < 0)
                return rc;              /* fatal error */
-
+#endif
        if (!list_empty(consoles)) {
                DBG(dbgprint("detection success [rc=%d]", reconnect));
                return reconnect;