Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbf54ad
)
debugfs: Fix error handling in strtoblk() and common_block_args_process()
author
Theodore Ts'o
<tytso@mit.edu>
Mon, 18 Feb 2008 14:55:04 +0000
(09:55 -0500)
committer
Theodore Ts'o
<tytso@mit.edu>
Mon, 18 Feb 2008 20:27:04 +0000
(15:27 -0500)
Fix strtoblk() to allow a block number 0, and
common_block_args_process() so it prints an error message if a block
number that can't be parsed by strtoul().
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/util.c
patch
|
blob
|
history
diff --git
a/debugfs/util.c
b/debugfs/util.c
index
7031850
..
cb84bd2
100644
(file)
--- a/
debugfs/util.c
+++ b/
debugfs/util.c
@@
-274,10
+274,8
@@
int strtoblk(const char *cmd, const char *str, blk_t *ret)
blk = parse_ulong(str, cmd, "block number", &err);
*ret = blk;
- if (err == 0 && blk == 0) {
- com_err(cmd, 0, "Invalid block number 0");
- err = 1;
- }
+ if (err)
+ com_err(cmd, 0, "Invalid block number: %s", str);
return err;
}
@@
-337,6
+335,11
@@
int common_block_args_process(int argc, char *argv[],
if (strtoblk(argv[0], argv[1], block))
return 1;
+ if (*block == 0) {
+ com_err(argv[0], 0, "Invalid block number 0");
+ err = 1;
+ }
+
if (argc > 2) {
*count = parse_ulong(argv[2], argv[0], "count", &err);
if (err)