From: Philippe Troin Date: Sun, 19 May 2019 05:08:11 +0000 (-0700) Subject: Open files with permissions 0666 and let umask(2) do its job. X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~39^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f1eed23e23e956649ee9441abbcb8abd002e00ae;p=zchunk.git Open files with permissions 0666 and let umask(2) do its job. When creating files, zchunk did not obey the users's umask(2) setting. --- diff --git a/src/unzck.c b/src/unzck.c index d46a4d5..8d6c62a 100644 --- a/src/unzck.c +++ b/src/unzck.c @@ -139,7 +139,7 @@ int main (int argc, char *argv[]) { int dst_fd = STDOUT_FILENO; if(!arguments.stdout) { - dst_fd = open(out_name, O_TRUNC | O_WRONLY | O_CREAT, 0644); + dst_fd = open(out_name, O_TRUNC | O_WRONLY | O_CREAT, 0666); if(dst_fd < 0) { dprintf(STDERR_FILENO, "Unable to open %s", out_name); perror(""); diff --git a/src/zck.c b/src/zck.c index 252ae55..84231b1 100644 --- a/src/zck.c +++ b/src/zck.c @@ -179,7 +179,7 @@ int main (int argc, char *argv[]) { close(dict_fd); } - int dst_fd = open(out_name, O_TRUNC | O_WRONLY | O_CREAT, 0644); + int dst_fd = open(out_name, O_TRUNC | O_WRONLY | O_CREAT, 0666); if(dst_fd < 0) { dprintf(STDERR_FILENO, "Unable to open %s", out_name); perror(""); diff --git a/src/zck_dl.c b/src/zck_dl.c index 2062138..045f08f 100644 --- a/src/zck_dl.c +++ b/src/zck_dl.c @@ -314,7 +314,7 @@ int main (int argc, char *argv[]) { } char *outname = basename(arguments.args[0]); - int dst_fd = open(outname, O_RDWR | O_CREAT, 0644); + int dst_fd = open(outname, O_RDWR | O_CREAT, 0666); if(dst_fd < 0) { dprintf(STDERR_FILENO, "Unable to open %s: %s\n", outname, strerror(errno)); diff --git a/src/zck_gen_zdict.c b/src/zck_gen_zdict.c index ab96bff..030f09a 100644 --- a/src/zck_gen_zdict.c +++ b/src/zck_gen_zdict.c @@ -224,7 +224,7 @@ int main (int argc, char *argv[]) { assert(dict_block); snprintf(dict_block, strlen(dir) + strlen(out_name) + 12, "%s/%s.%li", dir, out_name, zck_get_chunk_number(idx)); - int dst_fd = open(dict_block, O_TRUNC | O_WRONLY | O_CREAT, 0644); + int dst_fd = open(dict_block, O_TRUNC | O_WRONLY | O_CREAT, 0666); if(dst_fd < 0) { dprintf(STDERR_FILENO, "Unable to open %s", dict_block); perror(""); diff --git a/test/copy_chunks.c b/test/copy_chunks.c index b8d5b9f..ad8f2fb 100644 --- a/test/copy_chunks.c +++ b/test/copy_chunks.c @@ -49,7 +49,7 @@ int main (int argc, char *argv[]) { perror("Unable to open LICENSE.header.new.nodict.fodt.zck for reading"); exit(1); } - int tgt = open(base_name, O_RDWR | O_CREAT, 0644); + int tgt = open(base_name, O_RDWR | O_CREAT, 0666); if(tgt < 0) { perror("Unable to open LICENSE.header.new.nodict.fodt.zck for writing"); exit(1);