From: Kinglong Mee <kinglongmee@gmail.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH 1/2] fsck.f2fs: fix bad notice of missing device
Date: Fri, 17 Mar 2017 21:55:50 +0800 [thread overview]
Message-ID: <5dab8657-2e51-3096-ac6c-3b033e13c19b@gmail.com> (raw)
In-Reply-To: <e1f0d651-9e81-2030-5d76-de17bac2b188@gmail.com>
The following messages is better than before.
Before,
# fsck.f2fs -d 1
Error: Need argument for -d
Now,
# fsck.f2fs -d 1
Info: Debug level = 1
Error: Device not specified
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fsck/main.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fsck/main.c b/fsck/main.c
index cf1e8af..88fe5f8 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -114,8 +114,6 @@ void f2fs_parse_options(int argc, char *argv[])
MSG(0, "\tError: Device not specified\n");
error_out(prog);
}
- c.devices[0].path = strdup(argv[argc - 1]);
- argv[argc-- - 1] = 0;
if (!strcmp("fsck.f2fs", prog)) {
const char *option_string = ":ad:fp:t";
@@ -372,7 +370,14 @@ void f2fs_parse_options(int argc, char *argv[])
break;
}
}
- if (argc > optind) {
+
+ if (optind >= argc) {
+ MSG(0, "\tError: Device not specified\n");
+ error_out(prog);
+ }
+
+ c.devices[0].path = strdup(argv[optind]);
+ if (argc > (optind + 1)) {
c.dbg_lv = 0;
err = EUNKNOWN_ARG;
}
--
2.9.3
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
parent reply other threads:[~2017-03-17 13:56 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <e1f0d651-9e81-2030-5d76-de17bac2b188@gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5dab8657-2e51-3096-ac6c-3b033e13c19b@gmail.com \
--to=kinglongmee@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).