* lib/truncate.c (truncate): Pass an O_CLOEXEC flag to open().
+2020-05-28 Bruno Haible <bruno@clisp.org>
+
+ truncate: Make more robust in multithreaded applications.
+ * lib/truncate.c (truncate): Pass an O_CLOEXEC flag to open().
+
2020-05-28 Bruno Haible <bruno@clisp.org>
pagealign_alloc: Make more robust in multithreaded applications.
if (length == 0)
{
- fd = open (filename, O_WRONLY | O_TRUNC);
+ fd = open (filename, O_WRONLY | O_TRUNC | O_CLOEXEC);
if (fd < 0)
return -1;
}
else
{
- fd = open (filename, O_WRONLY);
+ fd = open (filename, O_WRONLY | O_CLOEXEC);
if (fd < 0)
return -1;
if (ftruncate (fd, length) < 0)