]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hardlink: use open(O_CREAT) with mode
authorKarel Zak <kzak@redhat.com>
Thu, 2 Dec 2021 14:00:44 +0000 (15:00 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 2 Dec 2021 14:00:44 +0000 (15:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c

index 6253f85db321927ad4b1f74aadf723b96804df91..b93530861658b9c7c2f2b692cce628755a8f7b3f 100644 (file)
@@ -643,7 +643,7 @@ static inline int do_link(struct file *a, struct file *b,
        if (reflink) {
                int dest = -1, src = -1;
 
-               dest = open(new_name, O_CREAT|O_WRONLY|O_TRUNC);
+               dest = open(new_name, O_CREAT|O_WRONLY|O_TRUNC, 0600);
                if (dest < 0)
                        goto fallback;
                if (fchmod(dest, b->st.st_mode) != 0)