summaryrefslogtreecommitdiff
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-04-04 04:00:42 +1000
committerNeilBrown <neilb@suse.de>2012-04-04 14:03:13 +1000
commit15632a96f4e6919b4fa54c622e9e14d7fdae42d1 (patch)
tree876582e51d98f08bd2962851c992b9e008e9c91a /mdadm.c
parent3556c2fafbfb408103c9ed92d61b492b7adf6a6f (diff)
parse_size: distinguish between 0 and error.
It isn't sufficient to use '0' for 'error' as well will later have fields that can validly be '0'. So return "-1" on error. Also fix parsing of --bitmap_check so that '0' is treated as an error: we don't support 512B anyway. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mdadm.c b/mdadm.c
index 1efa3e80..4d4820d3 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1056,15 +1056,14 @@ int main(int argc, char *argv[])
case O(BUILD,BitmapChunk):
case O(CREATE,BitmapChunk): /* bitmap chunksize */
bitmap_chunk = parse_size(optarg);
- if (bitmap_chunk < 0 ||
+ if (bitmap_chunk <= 0 ||
bitmap_chunk & (bitmap_chunk - 1)) {
fprintf(stderr,
Name ": invalid bitmap chunksize: %s\n",
optarg);
exit(2);
}
- /* convert sectors to B, chunk of 0 means 512B */
- bitmap_chunk = bitmap_chunk ? bitmap_chunk * 512 : 512;
+ bitmap_chunk = bitmap_chunk * 512;
continue;
case O(GROW, WriteBehind):