summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2018-07-04 16:09:20 (GMT)
committerWaldemar Brodkorb <wbrodkorb@conet.de>2018-08-10 14:02:45 (GMT)
commit1a2cdf20c9c47ddacb6370431f676fd55bfbfebb (patch)
treee0ae55ac63395554de4b4f068f1b7b9686fcb4eb
parente54692f524c5ada8883afcdd65b2ab998083c3fe (diff)
Fix shm_open posix compliance error code
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é <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
-rw-r--r--librt/shm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/librt/shm.c b/librt/shm.c
index 40e69fa..79c98a3 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;
}