libc/mktemp: Pass flags to open()
authorSimon Arlott <sa.me.uk>
Sat, 3 Nov 2018 20:08:07 +0000 (20:08 +0000)
committerAaron LI <aly@aaronly.me>
Mon, 5 Nov 2018 14:33:16 +0000 (22:33 +0800)
commit1fa9cec2ee4817e109c7359b2ee77108c299a2cd
tree7614e9d075cd47a5641002dcb89ba5df743a2446
parentbaf84f0ae5e25ae2d46fba3c9aafca24ba8e6074
libc/mktemp: Pass flags to open()

The flags from the functions that call _gettemp() are never used.

They should be included in the call to open(), otherwise features like
O_CLOEXEC don't work.

aly:
(1) Checked FreeBSD and it behaves the same way as this fix.
(2) Improve the style a bit.
lib/libc/stdio/mktemp.c