[rrd-developers] [PATCH] [BUG] rrd_open should not create files with restrictive masks

Tobias Oetiker tobi at oetiker.ch
Sun Oct 19 00:32:32 CEST 2008


Yesterday kevin brintnall wrote:

> rrd_open should not create files with restrictive masks
>
> Removed unnecessary "mode" varaible.  The mode is only used when O_CREAT is
> specified, where we want to use 0666 (as rrd_create_fn did r<=1612).
>
> Reported by Joerg Linge.

right
tobi
>
> ---
>  src/rrd_open.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/src/rrd_open.c b/src/rrd_open.c
> index 8ae5fd8..d213a45 100644
> --- a/src/rrd_open.c
> +++ b/src/rrd_open.c
> @@ -71,7 +71,6 @@ rrd_file_t *rrd_open(
>  {
>      int i;
>      int       flags = 0;
> -    mode_t    mode = S_IRUSR;
>      int       version;
>
>  #ifdef HAVE_MMAP
> @@ -137,7 +136,6 @@ rrd_file_t *rrd_open(
>  #endif
>      } else {
>          if (rdwr & RRD_READWRITE) {
> -            mode |= S_IWUSR;
>              flags |= O_RDWR;
>  #ifdef HAVE_MMAP
>              rrd_file->mm_flags = MAP_SHARED;
> @@ -160,7 +158,7 @@ rrd_file_t *rrd_open(
>      flags |= O_BINARY;
>  #endif
>
> -    if ((rrd_file->fd = open(file_name, flags, mode)) < 0) {
> +    if ((rrd_file->fd = open(file_name, flags, 0666)) < 0) {
>          rrd_set_error("opening '%s': %s", file_name, rrd_strerror(errno));
>          goto out_free;
>      }
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list