diff mbox

[3/5] btrfs-progs: Avoid using uninitialized optind in cmd_rescue_zero_log

Message ID ec5de1a7a0e4e46cd0b51e5fb63f39a69325cf31.1441357933.git.zhaolei@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhaolei Sept. 4, 2015, 1:24 p.m. UTC
Better to avoid using optind in cmd_rescue_zero_log(), because no
getopt() before.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 cmds-rescue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/cmds-rescue.c b/cmds-rescue.c
index 163d0bb..a709e1b 100644
--- a/cmds-rescue.c
+++ b/cmds-rescue.c
@@ -182,7 +182,7 @@  int cmd_rescue_zero_log(int argc, char **argv)
 	if (check_argc_exact(argc, 2))
 		usage(cmd_rescue_zero_log_usage);
 
-	devname = argv[optind];
+	devname = argv[1];
 	ret = check_mounted(devname);
 	if (ret < 0) {
 		fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));