[collectd] rrdc_update failed with status -1

Bruno Prémont bonbons at linux-vserver.org
Thu Mar 29 13:35:39 CEST 2012

On Thu, 29 Mar 2012 13:25:30 Benjamin DUPUIS wrote:
> umask in init script doesn't work for me (RHEL5).

As documented in mkdir()'s manpage, the mask specified has umask
applied on it. If the specified mode is more restrictive than umask it
will win, thus mode should first be set to permissive, e.g. 0777, and
then umask will work.

> I never coded in C, only C++ for more than 10 years ago :)

Adding umask as configuration option is slightly harder but should be
easy looking at how other global options are defined.

The change you listed as one-liner looks good to me, just check the
rest of collectd code for more mkdir() invocations and send the patch
(which you can obtain it with `git patch --path-with-stat` if you
previously cloned git repo)

Best regards,

> ----- Message d'origine -----
> De: Bruno Prémont <bonbons at linux-vserver.org>
> Date: Thu, 29 Mar 2012 12:00:12 +0200
> Sujet: Re: [collectd] rrdc_update failed with status -1
> À: Benjamin DUPUIS <benjamin.dupuis at quake.fr>
> Cc: collectd at verplant.org
> >On Thu, 29 Mar 2012 11:46:16 Benjamin DUPUIS wrote:
> >> I've modified
> >> * src/collectd.c Line 211 : if (mkdir (orig_dir, 0775) == -1)
> >> * src/common.c   Line 551 : if (mkdir (dir, 0775) == 0)
> >> 
> >> It's now working.
> >> I don't know if it's a good solution perhaps it'll be a good idea to
> >> have a configuration entry in the configuration of rrdcached /
> >> rrdtools ?
> >
> >I think it would even be better to change mode to 0777 and let umask do
> >the whole work, eventually having global umask configuration option in
> >collectd config file so umask setting does not have to be delegated to
> >init script (where it is not set and thus depends on umask of init or
> >the shell [re]starting the daemon).
> >
> >The same has to apply for csv and the other write plugins that may
> >create new files.
> >
> >Having configurable mode gets hard, especially as then on might also
> >want to control owner/group and possibly ACLs or more!
> >
> >Would you mind creating a patch for it?

More information about the collectd mailing list