chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: pass original flags value to mkostemp(), in open_tmpfile()
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index 0e7d5c5fb3388e39236af01d73f73503b9ddafec..a6e86148d1bb49d9dfb421fc079bd814a55690c8 100644
(file)
--- 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 open_tmpfile(const char *path, int flags) {
- int fd;
char *p;
char *p;
+ int fd;
+
+ assert(path);
#ifdef O_TMPFILE
#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");
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;
if (fd < 0)
return fd;