X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=program%2Fsrc%2Frrd_resize.c;h=39941c1cd4ada12fbf79bca413e44a904edb588a;hb=90379ba93cec161967362381abdc7e02820d7bb9;hp=877120ed43c50897dd7afab06703523ff0f23554;hpb=bdd9921d373849e129247adb6a25c0397c59e8d3;p=rrdtool-all.git diff --git a/program/src/rrd_resize.c b/program/src/rrd_resize.c index 877120ed..39941c1c 100644 --- a/program/src/rrd_resize.c +++ b/program/src/rrd_resize.c @@ -43,7 +43,7 @@ rrd_resize(int argc, char **argv) modify=strtol(argv[4],&endptr,0); if ((modify<1)) { - rrd_set_error("you must have at least one row in the RRA"); + rrd_set_error("Please grow or shrink with at least 1 row"); return(-1); } @@ -67,12 +67,14 @@ rrd_resize(int argc, char **argv) fclose(infile); return(-1); } - if ((rrdold.rra_def[target_rra].row_cnt+modify)<0) { - rrd_set_error("This RRA is not that big"); - rrd_free(&rrdold); - fclose(infile); - return(-1); - } + + if (modify < 0) + if (rrdold.rra_def[target_rra].row_cnt <= -modify) { + rrd_set_error("This RRA is not that big"); + rrd_free(&rrdold); + fclose(infile); + return(-1); + } rrdnew.stat_head = rrdold.stat_head; rrdnew.ds_def = rrdold.ds_def;