From 269a0ca00717d2f43f03be5f7b034d93fb33f473 Mon Sep 17 00:00:00 2001 From: Christine Caulfield Date: Mon, 8 Apr 2019 13:31:38 +0100 Subject: [PATCH] ipc: use O_EXCL when opening IPC files --- lib/ipc_us.c | 2 +- lib/ringbuffer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- libqb.git.orig/lib/ipc_us.c +++ libqb.git/lib/ipc_us.c @@ -881,7 +881,7 @@ fd_hdr = qb_sys_mmap_file_open(path, r->request, sizeof(struct ipc_us_control), - O_CREAT | O_TRUNC | O_RDWR); + O_CREAT | O_TRUNC | O_RDWR | O_EXCL); if (fd_hdr < 0) { res = -errno; qb_util_perror(LOG_ERR, "couldn't create file for mmap"); --- libqb.git.orig/lib/ringbuffer.c +++ libqb.git/lib/ringbuffer.c @@ -116,7 +116,7 @@ sizeof(struct qb_ringbuffer_shared_s) + shared_user_data_size; if (flags & QB_RB_FLAG_CREATE) { - file_flags |= O_CREAT | O_TRUNC; + file_flags |= O_CREAT | O_TRUNC | O_EXCL; } rb = calloc(1, sizeof(struct qb_ringbuffer_s));