From: Bobi Jam Date: Tue, 23 Mar 2021 03:18:25 +0000 (+0800) Subject: LU-14422 utils: check empty stripe-count/offset setting X-Git-Tag: 2.15.51~199 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=50a7921471298fdc3a28107e7f026504db784aa5;p=fs%2Flustre-release.git LU-14422 utils: check empty stripe-count/offset setting Prohibit "" stripe count and stripe offset setting in lfs setstripe. Test-Parameters: trivial Signed-off-by: Bobi Jam Change-Id: I4d0cc2354c4249a31222e0f90de39e16ec4694a5 Reviewed-on: https://review.whamcloud.com/41793 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index e05f918..3a82712 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -3670,7 +3670,7 @@ static int lfs_setstripe_internal(int argc, char **argv, case 'c': errno = 0; lsa.lsa_stripe_count = strtoul(optarg, &end, 0); - if (errno != 0 || *end != '\0'|| + if (errno != 0 || *end != '\0'|| optarg == end || lsa.lsa_stripe_count < -1 || lsa.lsa_stripe_count > LOV_MAX_STRIPE_COUNT) { fprintf(stderr, @@ -3756,7 +3756,7 @@ static int lfs_setstripe_internal(int argc, char **argv, case 'i': errno = 0; lsa.lsa_stripe_off = strtol(optarg, &end, 0); - if (errno != 0 || *end != '\0' || + if (errno != 0 || *end != '\0' || optarg == end || lsa.lsa_stripe_off < -1 || lsa.lsa_stripe_off > LOV_V1_INSANE_STRIPE_COUNT) { fprintf(stderr,