From 50a7921471298fdc3a28107e7f026504db784aa5 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Tue, 23 Mar 2021 11:18:25 +0800 Subject: [PATCH] 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 --- lustre/utils/lfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, -- 1.8.3.1