diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-01-28 13:09:14 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-01-28 13:09:14 +0100 |
commit | a6afc4aeaa5018859f8c8a397001ee4e3794545e (patch) | |
tree | 53ada6f112b9320d40012054dbc43101535de761 | |
parent | d37a91e860ce953079870bdbd2526b2c04bb9ea5 (diff) |
util: pass original flags value to mkostemp(), in open_tmpfile()
-rw-r--r-- | src/shared/util.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 0e7d5c5fb3..a6e86148d1 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -6147,17 +6147,19 @@ int mkostemp_safe(char *pattern, int flags) { } int open_tmpfile(const char *path, int flags) { - int fd; char *p; + int fd; + + assert(path); #ifdef O_TMPFILE - fd = open(path, flags|O_TMPFILE, S_IRUSR|S_IWUSR); + fd = open(path, flags|O_TMPFILE|O_NOCTTY, S_IRUSR|S_IWUSR); if (fd >= 0) return fd; #endif p = strappenda(path, "/systemd-tmp-XXXXXX"); - fd = mkostemp_safe(p, O_RDWR|O_CLOEXEC); + fd = mkostemp_safe(p, flags); if (fd < 0) return fd; |