1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

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 <abushwangs@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
abushwang
2023-03-07 20:16:20 +08:00
committed by Adhemerval Zanella
parent 65387e4809
commit 0b7bf0e0a4
3 changed files with 15 additions and 7 deletions

View File

@@ -30,9 +30,10 @@ int
__shm_open (const char *name, int oflag, mode_t mode)
{
struct shmdir_name dirname;
if (__shm_get_name (&dirname, name, false) != 0)
int ret =__shm_get_name (&dirname, name, false);
if (ret != 0)
{
__set_errno (EINVAL);
__set_errno (ret);
return -1;
}