[vlc-devel] [PATCH] linux: vlc_memfd: handle EOPNOTSUPP errno

Thomas Guillem thomas at gllm.fr
Fri Jun 14 09:17:16 CEST 2019


from manpage:

BUGS
One must check for two different error codes, EISDIR and ENOENT, when trying to determine whether the kernel
supports O_TMPFILE functionality.


On Thu, Jun 13, 2019, at 14:41, Rémi Denis-Courmont wrote:
> ENOENT is checked because /tmp might not exist, not because of O_TMPFILE
> 
> Le 13 juin 2019 19:48:14 GMT+08:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>> From man open(2):
>> EOPNOTSUPP: The filesystem containing pathname does not support O_TMPFILE. 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..3712f4ba06 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 != ENOENT && 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, ENOENT, or EOPNOTSUPP, cf. man open(2). */
>>      char bufpath[] = "/tmp/"PACKAGE_NAME"XXXXXX";
>>      fd = vlc_mkstemp(bufpath);
>>      if (fd != -1)
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190614/1dc10781/attachment.html>


More information about the vlc-devel mailing list