|
Message-ID: <20241029030111.708854-1-lihua.zhao.cn@windriver.com> Date: Tue, 29 Oct 2024 11:01:11 +0800 From: <lihua.zhao.cn@...driver.com> To: <musl@...ts.openwall.com> CC: <lihua.zhao.cn@...driver.com> Subject: [PATCH] fix sem_unlink reporting wrong errno From: Lihua Zhao <lihua.zhao.cn@...driver.com> When the input name is invalid, it should set errno with ENOENT, but this routine is also used by shm_open(), it set the errno with EINVAL. Signed-off-by: Lihua Zhao <lihua.zhao.cn@...driver.com> --- src/mman/shm_open.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mman/shm_open.c b/src/mman/shm_open.c index 79784bd3..8383ffad 100644 --- a/src/mman/shm_open.c +++ b/src/mman/shm_open.c @@ -38,6 +38,10 @@ int shm_open(const char *name, int flag, mode_t mode) int shm_unlink(const char *name) { char buf[NAME_MAX+10]; - if (!(name = __shm_mapname(name, buf))) return -1; + if (!(name = __shm_mapname(name, buf))) { + if (errno == EINVAL) errno = ENOENT; + return -1; + } + return unlink(name); } -- 2.43.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.