File bsc#1137835-0001-ipc-use-O_EXCL-when-opening-IPC-files.patch of Package libqb.26134
From 269a0ca00717d2f43f03be5f7b034d93fb33f473 Mon Sep 17 00:00:00 2001
From: Christine Caulfield <ccaulfie@redhat.com>
Date: Mon, 8 Apr 2019 13:31:38 +0100
Subject: [PATCH] ipc: use O_EXCL when opening IPC files
---
lib/ipc_socket.c | 2 +-
lib/ringbuffer.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ipc_socket.c b/lib/ipc_socket.c
index fe2040e..1f7cde3 100644
--- a/lib/ipc_socket.c
+++ b/lib/ipc_socket.c
@@ -790,7 +790,7 @@ qb_ipcs_us_connect(struct qb_ipcs_service *s,
fd_hdr = qb_sys_mmap_file_open(path, r->request,
SHM_CONTROL_SIZE,
- O_CREAT | O_TRUNC | O_RDWR);
+ O_CREAT | O_TRUNC | O_RDWR | O_EXCL);
if (fd_hdr < 0) {
res = fd_hdr;
errno = -fd_hdr;
diff --git a/lib/ringbuffer.c b/lib/ringbuffer.c
index 81411cb..8852ff5 100644
--- a/lib/ringbuffer.c
+++ b/lib/ringbuffer.c
@@ -155,7 +155,7 @@ qb_rb_open_2(const char *name, size_t size, uint32_t flags,
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));
--
2.16.4