summaryrefslogtreecommitdiffstats
path: root/login-utils/chsh.c
diff options
context:
space:
mode:
authorSami Kerola2014-12-19 23:49:32 +0100
committerSami Kerola2015-01-05 23:52:51 +0100
commit9a5cbe5223264038e5dc8e87e0ec1ba4fd1b160c (patch)
tree1af2739b04fd38f01122ed7cad60ff5f7ee7dfdb /login-utils/chsh.c
parentchsh: simplify check_shell() (diff)
downloadkernel-qcow2-util-linux-9a5cbe5223264038e5dc8e87e0ec1ba4fd1b160c.tar.gz
kernel-qcow2-util-linux-9a5cbe5223264038e5dc8e87e0ec1ba4fd1b160c.tar.xz
kernel-qcow2-util-linux-9a5cbe5223264038e5dc8e87e0ec1ba4fd1b160c.zip
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 <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/chsh.c')
-rw-r--r--login-utils/chsh.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/login-utils/chsh.c b/login-utils/chsh.c
index 3c5178306..a84e3ff74 100644
--- a/login-utils/chsh.c
+++ b/login-utils/chsh.c
@@ -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