[vlc-commits] linux: vlc_memfd: handle EOPNOTSUPP errno

Thomas Guillem git at videolan.org
Fri Jun 14 16:49:25 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 13 13:45:58 2019 +0200| [efcd1f8e597861030102fd846bc449a9f916f27b] | committer: Thomas Guillem

linux: vlc_memfd: handle EOPNOTSUPP errno

And remove useless ENOENT check: if open() fails with ENOENT, then mkstemp()
will fail with the same error.

>From man open(2):
EOPNOTSUPP: The filesystem containing pathname does not support O_TMPFILE.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=efcd1f8e597861030102fd846bc449a9f916f27b
---

 src/linux/filesystem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/linux/filesystem.c b/src/linux/filesystem.c
index caa97fbf3f..47b7a74a31 100644
--- a/src/linux/filesystem.c
+++ b/src/linux/filesystem.c
@@ -45,10 +45,11 @@ int vlc_memfd(void)
 
     /* Fallback to open with O_TMPFILE, */
     fd = open("/tmp", O_RDWR | O_CLOEXEC | O_TMPFILE, S_IRUSR | S_IWUSR);
-    if (fd != -1 || (errno != EISDIR && errno != ENOENT))
+    if (fd != -1 || (errno != EISDIR && errno != EOPNOTSUPP))
         return fd;
 
-    /* Fallback to POSIX implementation if O_TMPFILE is not supported */
+    /* Fallback to POSIX implementation if O_TMPFILE is not supported (errno is
+     * EISDIR, or EOPNOTSUPP, cf. man open(2). */
     char bufpath[] = "/tmp/"PACKAGE_NAME"XXXXXX";
     fd = vlc_mkstemp(bufpath);
     if (fd != -1)



More information about the vlc-commits mailing list