diff options
Diffstat (limited to 'src/lib/util/disk.c')
-rw-r--r-- | src/lib/util/disk.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/util/disk.c b/src/lib/util/disk.c index 5dd06fdfb..3ff67c090 100644 --- a/src/lib/util/disk.c +++ b/src/lib/util/disk.c | |||
@@ -1250,6 +1250,9 @@ GNUNET_DISK_file_open (const char *fn, | |||
1250 | } | 1250 | } |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | // Setting O_CLOEXEC after pipe() may introduce | ||
1254 | // race conditions: https://bugs.gnunet.org/view.php?id=9311 | ||
1255 | // This is no problem if the platform supports pipe2 | ||
1253 | fd = open (expfn, | 1256 | fd = open (expfn, |
1254 | oflags | 1257 | oflags |
1255 | #if O_CLOEXEC | 1258 | #if O_CLOEXEC |
@@ -1417,7 +1420,11 @@ GNUNET_DISK_pipe (enum GNUNET_DISK_PipeFlags pf) | |||
1417 | { | 1420 | { |
1418 | int fd[2]; | 1421 | int fd[2]; |
1419 | 1422 | ||
1423 | #if HAVE_PIPE2 && O_CLOEXEC | ||
1424 | if (-1 == pipe2 (fd, O_CLOEXEC)) | ||
1425 | #else | ||
1420 | if (-1 == pipe (fd)) | 1426 | if (-1 == pipe (fd)) |
1427 | #endif | ||
1421 | { | 1428 | { |
1422 | int eno = errno; | 1429 | int eno = errno; |
1423 | 1430 | ||