summaryrefslogtreecommitdiffstats
path: root/sys-utils/fallocate.c
diff options
context:
space:
mode:
authorKarel Zak2015-01-07 09:57:55 +0100
committerKarel Zak2015-01-07 09:57:55 +0100
commit185aa9e5b8c809d4ee73d56256632ed0f739d220 (patch)
tree7c8aa0a123da323530e06404ab3ae7c4462973e3 /sys-utils/fallocate.c
parentlibmount: (monitor) make mnt_monitor_next_changed() usable for epoll version too (diff)
downloadkernel-qcow2-util-linux-185aa9e5b8c809d4ee73d56256632ed0f739d220.tar.gz
kernel-qcow2-util-linux-185aa9e5b8c809d4ee73d56256632ed0f739d220.tar.xz
kernel-qcow2-util-linux-185aa9e5b8c809d4ee73d56256632ed0f739d220.zip
fallocate: create mode 0666, that's what umask is for
User's umask will typically mask the mode down to 0664 or 0644. Reported-by: Peter Cordes <peter@cordes.ca> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/fallocate.c')
-rw-r--r--sys-utils/fallocate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index 0e4eb4971..84b06b960 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -368,7 +368,8 @@ int main(int argc, char **argv)
/* O_CREAT makes sense only for the default fallocate(2) behavior
* when mode is no specified and new space is allocated */
- fd = open(filename, O_RDWR | (!dig && !mode ? O_CREAT : 0), 0644);
+ fd = open(filename, O_RDWR | (!dig && !mode ? O_CREAT : 0),
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), filename);