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

kevin brintnall kbrint at rufus.net
Sat Oct 18 22:31:35 CEST 2008


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.

---
 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;
     }
-- 
1.6.0.2



More information about the rrd-developers mailing list