X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_create.c;h=15412e22ab3424b05eaed4fb59180889b9d1a0ec;hb=9e6db622e8756105c1322481b34650ecbe15da1a;hp=cf8749e290079053663a23d7cf95e78a6aead9b5;hpb=361a0fd38d7adf95847508f54c0bde9b3f98662e;p=rrdtool.git diff --git a/src/rrd_create.c b/src/rrd_create.c index cf8749e..15412e2 100644 --- a/src/rrd_create.c +++ b/src/rrd_create.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.8 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.14 Copyright by Tobi Oetiker, 1997-2006 ***************************************************************************** * rrd_create.c creates new rrds *****************************************************************************/ @@ -78,7 +78,10 @@ rrd_create(int argc, char **argv) return(-1); } } - + if (optind == argc) { + rrd_set_error("what is the name of the rrd file you want to create?"); + return -1; + } rc = rrd_create_r(argv[optind], pdp_step, last_up, argc - optind - 1, argv + optind + 1); @@ -95,7 +98,8 @@ rrd_create_r(char *filename, rrd_t rrd; long i; int offset; - char *token,dummychar1,dummychar2; + char *token; + char dummychar1[2], dummychar2[2]; unsigned short token_idx, error_flag, period=0; unsigned long hashed_name; @@ -149,9 +153,9 @@ rrd_create_r(char *filename, switch (sscanf(&argv[i][3], DS_NAM_FMT "%1[:]" DST_FMT "%1[:]%n", rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam, - &dummychar1, + dummychar1, rrd.ds_def[rrd.stat_head->ds_cnt].dst, - &dummychar2, + dummychar2, &offset)) { case 0: case 1: rrd_set_error("Invalid DS name"); break; @@ -553,8 +557,11 @@ rrd_create_fn(char *file_name, rrd_t *rrd) if ((rrd_file = fopen(file_name,"wb")) == NULL ) { rrd_set_error("creating '%s': %s",file_name, rrd_strerror(errno)); free(rrd->stat_head); + rrd->stat_head = NULL; free(rrd->ds_def); + rrd->ds_def = NULL; free(rrd->rra_def); + rrd->rra_def = NULL; return(-1); }