summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-10-04 16:34:20 +1000
committerNeilBrown <neilb@suse.de>2012-10-04 16:34:20 +1000
commit822e393a050510b0002bdfb1b0554fa8d7860a99 (patch)
tree80799a3b855960a91c5aaa0bb8471a18988952a1 /util.c
parent7103b9b88d8c27989e17c80d7296eda97370dc1e (diff)
downloadmdadm-822e393a050510b0002bdfb1b0554fa8d7860a99.tar.gz
Allow parse_size to return 0.
We will shortly introduce --data-offset= which is allowed to be zero. We will want to use parse_size() so it needs to be able to return '0' without it being an error. So define INVALID_SECTORS to be an impossible value (currently '1') and return and test for it consistently. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util.c b/util.c
index fad72cc..4bd07e1 100644
--- a/util.c
+++ b/util.c
@@ -194,7 +194,7 @@ unsigned long long parse_size(char *size)
* followed by 'K', 'M', or 'G'.
* Without a suffix, K is assumed.
* Number returned is in sectors (half-K)
- * 0 returned on error.
+ * INVALID_SECTORS returned on error.
*/
char *c;
long long s = strtoll(size, &c, 10);
@@ -215,9 +215,9 @@ unsigned long long parse_size(char *size)
break;
}
} else
- s = 0;
+ s = INVALID_SECTORS;
if (*c)
- s = 0;
+ s = INVALID_SECTORS;
return s;
}