chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
basic: fix touch() creating files with 07777 mode
[elogind.git]
/
src
/
basic
/
fs-util.c
diff --git
a/src/basic/fs-util.c
b/src/basic/fs-util.c
index b13a9cbea7ca725d27b7b79de02aeaa7f73d3418..e895cac4f8573ea82a5971a9e30c4eeda87ea60a 100644
(file)
--- a/
src/basic/fs-util.c
+++ b/
src/basic/fs-util.c
@@
-333,7
+333,8
@@
int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gi
if (parents)
mkdir_parents(path, 0755);
if (parents)
mkdir_parents(path, 0755);
- fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, mode > 0 ? mode : 0644);
+ fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY,
+ (mode == 0 || mode == MODE_INVALID) ? 0644 : mode);
if (fd < 0)
return -errno;
if (fd < 0)
return -errno;