From 0b7bf0e0a486da6be7c5dde742a80c1138f9cc89 Mon Sep 17 00:00:00 2001 From: abushwang Date: Tue, 7 Mar 2023 20:16:20 +0800 Subject: rt: fix shm_open not set ENAMETOOLONG when name exceeds {_POSIX_PATH_MAX} according to man-pages-posix-2017, shm_open() function may fail if the length of the name argument exceeds {_POSIX_PATH_MAX} and set ENAMETOOLONG Signed-off-by: abushwang Reviewed-by: Adhemerval Zanella --- sysdeps/pthread/sem_open.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sysdeps/pthread') diff --git a/sysdeps/pthread/sem_open.c b/sysdeps/pthread/sem_open.c index 2551b035e1..2d32a13557 100644 --- a/sysdeps/pthread/sem_open.c +++ b/sysdeps/pthread/sem_open.c @@ -47,9 +47,10 @@ __sem_open (const char *name, int oflag, ...) } struct shmdir_name dirname; - if (__shm_get_name (&dirname, name, true) != 0) + int ret = __shm_get_name (&dirname, name, true); + if (ret != 0) { - __set_errno (EINVAL); + __set_errno (ret); return SEM_FAILED; } -- cgit 1.4.1