[fedfs-utils] [PATCH] libnsdb: set file mode on open(..., O_CREAT)

Jeff Layton jlayton at redhat.com
Thu Jul 7 13:33:20 PDT 2011


open(2) with O_CREAT requires the caller to provide a mode.

(Chuck: Does 0666 make sense here?)

Signed-off-by: Jeff Layton <jlayton at redhat.com>
---
 src/libnsdb/nsdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c
index cad92eb..00be913 100644
--- a/src/libnsdb/nsdb.c
+++ b/src/libnsdb/nsdb.c
@@ -532,7 +532,7 @@ nsdb_new_certfile(const char *certdata, const unsigned int certlen,
 		goto out;
 	}
 
-	fd = open(pathbuf, O_WRONLY | O_SYNC | O_CREAT | O_EXCL);
+	fd = open(pathbuf, O_WRONLY | O_SYNC | O_CREAT | O_EXCL, 0666);
 	if (fd == -1) {
 		xlog(D_GENERAL, "%s: Failed to open %s: %m",
 			__func__, pathbuf);
-- 
1.7.6




More information about the fedfs-utils-devel mailing list