From dba7598517a4abf388eee98fa4408f80b0063e01 Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Sun, 19 Jan 2025 21:03:25 -0500 Subject: [PATCH] posix: options: shm: use truncation flag that has been added Originally, when the POSIX_SHARED_MEMORY_OBJECTS option was added, the O_TRUNC flag was not consistently available. Now that it is consistently available, ensure it is used within the shm_open() function. Signed-off-by: Chris Friedt --- lib/posix/options/shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/posix/options/shm.c b/lib/posix/options/shm.c index d57fff74454..581728d2244 100644 --- a/lib/posix/options/shm.c +++ b/lib/posix/options/shm.c @@ -305,7 +305,7 @@ int shm_open(const char *name, int oflag, mode_t mode) bool rw = (oflag & O_RDWR) != 0; bool creat = (oflag & O_CREAT) != 0; bool excl = (oflag & O_EXCL) != 0; - bool trunc = false; /* (oflag & O_TRUNC) != 0 */ + bool trunc = (oflag & O_TRUNC) != 0; size_t name_len = (name == NULL) ? 0 : strnlen(name, PATH_MAX); /* revisit when file-based permissions are available */