Browse Source

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>
Christophe Lyon 2 years ago
parent
commit
1a2cdf20c9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      librt/shm.c

+ 3 - 0
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;
 }