From: Cristian Rodríguez Date: Mon, 11 May 2015 18:01:37 +0000 (-0300) Subject: shared: Use O_EXCL with O_TMPFILE in open_tmpfile X-Git-Tag: v226.4~1^2~398 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=eba20c2f8afe24a8bab713946a248b45dd2a80f1 shared: Use O_EXCL with O_TMPFILE in open_tmpfile In this usecase, the file will never be materialized with linkat(). --- diff --git a/src/shared/util.c b/src/shared/util.c index e36389eac..275fdece1 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4839,7 +4839,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