[systemd-devel] [PATCH] shared: Use O_EXCL with O_TMPFILE in open_tmpfile
Cristian RodrÃguez
crrodriguez at opensuse.org
Mon May 11 11:01:37 PDT 2015
In this usecase, the file will never be materialized
with linkat().
---
src/shared/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index c5c1b0c..f295edb 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4838,7 +4838,7 @@ int open_tmpfile(const char *path, int flags) {
#ifdef O_TMPFILE
/* Try O_TMPFILE first, if it is supported */
- fd = open(path, flags|O_TMPFILE, S_IRUSR|S_IWUSR);
+ fd = open(path, flags|O_TMPFILE|O_EXCL, S_IRUSR|S_IWUSR);
if (fd >= 0)
return fd;
#endif
--
2.3.7
More information about the systemd-devel
mailing list