Skip to content

Commit 269a0ca

Browse files
committed
ipc: use O_EXCL when opening IPC files
1 parent 28dff09 commit 269a0ca

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/ipc_socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ qb_ipcs_us_connect(struct qb_ipcs_service *s,
790790

791791
fd_hdr = qb_sys_mmap_file_open(path, r->request,
792792
SHM_CONTROL_SIZE,
793-
O_CREAT | O_TRUNC | O_RDWR);
793+
O_CREAT | O_TRUNC | O_RDWR | O_EXCL);
794794
if (fd_hdr < 0) {
795795
res = fd_hdr;
796796
errno = -fd_hdr;

lib/ringbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ qb_rb_open_2(const char *name, size_t size, uint32_t flags,
155155
sizeof(struct qb_ringbuffer_shared_s) + shared_user_data_size;
156156

157157
if (flags & QB_RB_FLAG_CREATE) {
158-
file_flags |= O_CREAT | O_TRUNC;
158+
file_flags |= O_CREAT | O_TRUNC | O_EXCL;
159159
}
160160

161161
rb = calloc(1, sizeof(struct qb_ringbuffer_s));

0 commit comments

Comments
 (0)