[klibc] fstype: Fix reversed test for "-" on command line

Colin Watson cjwatson at ubuntu.com
Thu Dec 21 02:54:48 PST 2006


The test for a "-" argument on the command line is reversed, so that
fstype will only attempt to open a file name provided on the command
line if it is "-", rather than only if it is not "-". This patch fixes
that.

Signed-off-by: Colin Watson <cjwatson at ubuntu.com>

diff -Nru klibc-1.4.30/usr/kinit/fstype/main.c klibc-1.4.30.new/usr/kinit/fstype/main.c
--- klibc-1.4.30/usr/kinit/fstype/main.c	2006-10-31 22:28:12.000000000 +0000
+++ klibc-1.4.30.new/usr/kinit/fstype/main.c	2006-12-21 10:51:46.000000000 +0000
@@ -37,7 +37,7 @@
 		return 1;
 	}
 
-	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '\0') {
+	if (argc > 1 && !(argv[1][0] == '-' && argv[1][1] == '\0')) {
 		fd = open(file = argv[1], O_RDONLY);
 		if (fd < 0) {
 			perror(argv[1]);

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]



More information about the klibc mailing list