[vlc-devel] [PATCH v2 4/13] esout: refactor GetTmpFile()
Rémi Denis-Courmont
remi at remlab.net
Thu Oct 8 21:30:35 CEST 2020
Le torstaina 8. lokakuuta 2020, 9.45.04 EEST Lyndon Brown a écrit :
> So are we keeping this option in which case we cannot in fact use
> tmpfile(), or are you wanting that option ripped out?
Personally I could hardly care less. It's buried in the deep in the
preferences where hardly anyone will find it. Disk space is also not the same
concern that it was 15 years ago when VLC grew timeshifting.
But even if you want to maintain that capability, the thing is there is no
proper abstraction for it in either the current code or your v2-patchset.
> 2. tmpfile() does not open the file in O_EXCL mode.
Sure it does. It's strictly speaking an implementation detail of the C
run-time library, but any sane implementation will use it, e.g.:
% ltrace ./a.out
tmpfile(1, 0x7ffe7fd17f98, 0x7ffe7fd17fa8, 0x7f299af67718) = 0x555a816a62a0
fclose(0x555a816a62a0) = 0
+++ exited (status 0) +++
22:26 remi at basile ~/videolan/vlc% strace ./a.out
execve("./a.out", ["./a.out"], 0x7ffcdfaeb9d0 /* 50 vars */) = 0
...
openat(AT_FDCWD, "/tmp", O_RDWR|O_EXCL|O_TMPFILE, 0600) = 3
fcntl(3, F_GETFL) = 0x418002 (flags O_RDWR|O_LARGEFILE|O_TMPFILE)
...
close(3) = 0
exit_group(0) = ?
+++ exited with 0 +++
> The C11 alternative tmpfile_s() does ("if supported by the OS") per the
> link in the next point, but I lack certainty of whether it's going to
> be available everywhere we need it.
C11 Annex K is a pile of crap that is best ignored and avoided.
We don't use fundamentally broken C interfaces, such as gets(). There is
nothing fundamentally broken about tmpfile().
--
レミ・デニ-クールモン
http://www.remlab.net/
More information about the vlc-devel
mailing list