[rrd-users] rrdtool create ERROR: can't create '/bad/path/foo.rrd'

Gilles Lamiral lamiral at mail.dotcom.fr
Sun Sep 17 15:59:58 MEST 2000


Hello,

Context: rrdtool create
-----------------------

I suggest to add a better error message in certain cases because it can be 
long to understand why the command failed.

1) permission denied
2) No such file or directory

I will add the control before calling rrdcreate to avoid those problems
in the future but I think rrdtool could be improved on this point.

I've looked at the source: rrd_create.c

int rrd_create_fn(char *file_name, rrd_t *rrd)
...
    if ((rrd_file = fopen(file_name,"wb")) == NULL ) {
        rrd_set_error("can't create '%s'",file_name);
...
    }

Suggestion : Why not use the errno set by fopen in case of failure?
perror() is bad for this case (rrd use its own error scheme) but
strerror() is the right solution, isn't it?

So the patch is one line:
rrd_set_error("can't create '%s' : %s",file_name,strerror(errno));

It works. Free source software is so good. I think I won't add any
control before calling rrdcreate because the next and last of last
1.0.x release will take the patch :-)

3) rrdcreate erases an existing rrd file. Is not it too hard?

Thanks in advance.
-- 
au revoir,
Gilles Lamiral. France, Laillé (35890).
33 (0) 2 99 42 33 80 
33 (0) 6 20 79 76 06

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list