[PATCH 09/14] chsh: fail get_shell_list() check when /etc/shells cannot be opened

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And get rid of stdbool.h true/false usage.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 login-utils/chsh.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/login-utils/chsh.c b/login-utils/chsh.c
index 3c51783..a84e3ff 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
-- 
2.2.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux