commit ae33cbb87a1109b718a535c7587433662dc98071
parent dd4afee4a8ea8c44126c44b31c6f1a36582d0964
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Thu, 10 Dec 2020 10:04:57 +0000
Use mkptemp2
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdio.h>
+#include <fcntl.h>
#include <skalibs/posixplz.h>
#include <skalibs/tai.h>
@@ -22,9 +23,8 @@ int ftrig1_make (ftrig1_t *f, char const *path)
tmp[pathlen + 2 + FTRIG1_PREFIXLEN] = ':' ;
if (!timestamp(tmp + pathlen + 3 + FTRIG1_PREFIXLEN)) return 0 ;
memcpy(tmp + pathlen + FTRIG1_PREFIXLEN + 28, ":XXXXXX", 8) ;
- ff.fd = mkptemp(tmp) ;
+ ff.fd = mkptemp2(tmp, O_NONBLOCK|O_CLOEXEC) ;
if (ff.fd == -1) return 0 ;
- if (ndelay_on(ff.fd) == -1) goto err1 ;
ff.fdw = open_write(tmp) ;
if (ff.fdw == -1) goto err1 ;
if (!stralloc_ready(&ff.name, pathlen + FTRIG1_PREFIXLEN + 36)) goto err2 ;