From: Sami Kerola Date: Fri, 19 Dec 2014 22:49:32 +0000 (+0000) Subject: chsh: fail get_shell_list() check when /etc/shells cannot be opened X-Git-Tag: v2.26-rc1~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a5cbe5223264038e5dc8e87e0ec1ba4fd1b160c;p=thirdparty%2Futil-linux.git chsh: fail get_shell_list() check when /etc/shells cannot be opened And get rid of stdbool.h true/false usage. Signed-off-by: Sami Kerola --- diff --git a/login-utils/chsh.c b/login-utils/chsh.c index 3c51783064..a84e3ff745 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -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