Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx> --- lib/cpg.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/cpg.c b/lib/cpg.c index a7dad33..046532b 100644 --- a/lib/cpg.c +++ b/lib/cpg.c @@ -48,6 +48,7 @@ #include <sys/socket.h> #include <sys/mman.h> #include <sys/uio.h> +#include <sys/stat.h> #include <errno.h> #include <limits.h> @@ -68,6 +69,11 @@ #define MAP_ANONYMOUS MAP_ANON #endif +/* + * ZCB files have following umask (umask is same as used in libqb) + */ +#define CPG_MEMORY_MAP_UMASK 077 + struct cpg_inst { qb_ipcc_connection_t *c; int finalize; @@ -737,13 +743,18 @@ memory_map (char *path, const char *file, void **buf, size_t bytes) size_t written; size_t page_size; long int sysconf_page_size; + mode_t old_umask; snprintf (path, PATH_MAX, "/dev/shm/%s", file); + old_umask = umask(CPG_MEMORY_MAP_UMASK); fd = mkstemp (path); + (void)umask(old_umask); if (fd == -1) { snprintf (path, PATH_MAX, LOCALSTATEDIR "/run/%s", file); + old_umask = umask(CPG_MEMORY_MAP_UMASK); fd = mkstemp (path); + (void)umask(old_umask); if (fd == -1) { return (-1); } -- 1.7.1 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss