lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  9 Nov 2017 15:59:34 +0900
From:   Wang Shilong <wangshilong1991@...il.com>
To:     linux-ext4@...r.kernel.org
Cc:     qian@....com
Subject: [PATCH] debugfs: fix ncheck program output

From: Qian Yingjin <qian@....com>

Fix the bug that print the inode number not the program name
when reporting bad inode name during checking in ncheck.
Minor bug fix: it should reduce iw->inodes_left when found
matched inode number.

Signed-off-by: Qian Yingjin <qian@....com>
---
 debugfs/ncheck.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c
index 5d9b5d2..dc4ab56 100644
--- a/debugfs/ncheck.c
+++ b/debugfs/ncheck.c
@@ -81,6 +81,7 @@ static int ncheck_proc(struct ext2_dir_entry *dirent,
 				}
 			}
 			putc('\n', stdout);
+			iw->inodes_left--;
 		}
 	}
 	if (!iw->inodes_left)
@@ -111,10 +112,8 @@ void do_ncheck(int argc, char **argv)
 			goto print_usage;
 		}
 	}
-	argc -= optind;
-	argv += optind;
 
-	if (argc < 1) {
+	if (argc <= 1) {
 	print_usage:
 		com_err(argv[0], 0, "Usage: ncheck [-c] <inode number> ...");
 		return;
@@ -122,6 +121,8 @@ void do_ncheck(int argc, char **argv)
 	if (check_fs_open(argv[0]))
 		return;
 
+	argc -= optind;
+	argv += optind;
 	iw.iarray = malloc(sizeof(ext2_ino_t) * argc);
 	if (!iw.iarray) {
 		com_err("ncheck", ENOMEM,
@@ -133,7 +134,7 @@ void do_ncheck(int argc, char **argv)
 	for (i=0; i < argc; i++) {
 		iw.iarray[i] = strtol(argv[i], &tmp, 0);
 		if (*tmp) {
-			com_err(argv[0], 0, "Bad inode - %s", argv[i]);
+			com_err("ncheck", 0, "Bad inode - %s", argv[i]);
 			goto error_out;
 		}
 	}
-- 
1.7.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ