From 1a2cdf20c9c47ddacb6370431f676fd55bfbfebb Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Wed, 4 Jul 2018 18:09:20 +0200 Subject: Fix shm_open posix compliance error code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle EISDIR in shm_open like glibc does, and set EINVAL. * librt/shm.c (shm_open): Handle EISDIR error. Signed-off-by: Mickaël Guêné Signed-off-by: Christophe Lyon --- librt/shm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/librt/shm.c b/librt/shm.c index 40e69fa2e..79c98a35b 100644 --- a/librt/shm.c +++ b/librt/shm.c @@ -84,6 +84,9 @@ int shm_open(const char *name, int oflag, mode_t mode) */ } #endif + if (fd < 0 && errno == EISDIR) + /* EISDIR is not valid for shm_open, replace it with EINVAL as glibc. */ + __set_errno (EINVAL); free(shm_name); /* doesn't affect errno */ return fd; } -- cgit v1.2.3