[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Linux-cluster] [PATCH] Fix ccsd /etc/cluster/cluster.conf file permissions



It is creating it with overly-generous permissions, but wouldn't it be
easier to either do something like this when we write the file:

mode_t om;

om = umask(026);
fp = fopen(...);
umask(om);

...or simply call umask(026) when ccsd starts up...?


> -    fp = fopen("/etc/cluster/cluster.conf-update", "w");
> +    cfd = open("/etc/cluster/cluster.conf-update", O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP);
> +    if(!cfd){
> +      log_sys_err("Unable to open file /etc/cluster/cluster.conf-update");
> +      error = -errno;
> +      goto fail;
> +    }
> +    fp = fdopen(cfd, "w");
>      if(!fp){
> -      log_sys_err("Unable to open /etc/cluster/cluster.conf-update");
> +      log_sys_err("Unable to open stream /etc/cluster/cluster.conf-update");
>        error = -errno;
>        goto fail;
>      }

-- Lon


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]