]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chsh: fail get_shell_list() check when /etc/shells cannot be opened
authorSami Kerola <kerolasa@iki.fi>
Fri, 19 Dec 2014 22:49:32 +0000 (22:49 +0000)
committerSami Kerola <kerolasa@iki.fi>
Mon, 5 Jan 2015 22:52:51 +0000 (22:52 +0000)
And get rid of stdbool.h true/false usage.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/chsh.c

index 3c517830642488e718012dd5fe0ff75b1a914387..a84e3ff745fc6fe3135e655bf75402f84737b4ba 100644 (file)
@@ -26,7 +26,6 @@
 #include <errno.h>
 #include <getopt.h>
 #include <pwd.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -87,16 +86,15 @@ static void __attribute__((__noreturn__)) usage (FILE *fp)
 static int get_shell_list(const char *shell_name)
 {
        FILE *fp;
-       int found;
+       int found = 0;
        char *buf = NULL;
        size_t sz = 0, len;
 
-       found = false;
        fp = fopen(_PATH_SHELLS, "r");
        if (!fp) {
                if (!shell_name)
                        warnx(_("No known shells."));
-               return true;
+               return 0;
        }
        while (getline(&buf, &sz, fp) != -1) {
                len = strlen(buf);
@@ -112,7 +110,7 @@ static int get_shell_list(const char *shell_name)
                /* check or output the shell */
                if (shell_name) {
                        if (!strcmp(shell_name, buf)) {
-                               found = true;
+                               found = 1;
                                break;
                        }
                } else