From: Petr Danecek Date: Mon, 28 Sep 2009 08:51:29 +0000 (+0000) Subject: Changed the mode for newly created files to 0666. This allows less strict permissions... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5078180f65e9723fa339c78d692b30a00dedcd6c;p=samtools.git Changed the mode for newly created files to 0666. This allows less strict permissions with umask properly set (e.g. 0002 vs. 0022). --- diff --git a/bgzf.c b/bgzf.c index 646b2b4..59f902f 100644 --- a/bgzf.c +++ b/bgzf.c @@ -199,7 +199,7 @@ bgzf_open(const char* __restrict path, const char* __restrict mode) #ifdef _WIN32 oflag |= O_BINARY; #endif - fd = open(path, oflag, 0644); + fd = open(path, oflag, 0666); if (fd == -1) return 0; fp = open_write(fd, strstr(mode, "u")? 1 : 0); } diff --git a/bgzip.c b/bgzip.c index eb88195..ac2a98e 100644 --- a/bgzip.c +++ b/bgzip.c @@ -50,7 +50,7 @@ static int write_open(const char *fn, int is_forced) int fd = -1; char c; if (!is_forced) { - if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644)) < 0 && errno == EEXIST) { + if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0666)) < 0 && errno == EEXIST) { printf("bgzip: %s already exists; do you wish to overwrite (y or n)? ", fn); scanf("%c", &c); if (c != 'Y' && c != 'y') { @@ -60,7 +60,7 @@ static int write_open(const char *fn, int is_forced) } } if (fd < 0) { - if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { + if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { fprintf(stderr, "bgzip: %s: Fail to write\n", fn); exit(1); } diff --git a/razf.c b/razf.c index 9b9267e..2ce364e 100644 --- a/razf.c +++ b/razf.c @@ -511,9 +511,9 @@ static inline RAZF* _razf_open(const char *filename, const char *mode, int _load rz = razf_open_r(fd, _load_index); } else if(strstr(mode, "w")){ #ifdef _WIN32 - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); #else - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); #endif if(fd < 0) return NULL; rz = razf_open_w(fd); diff --git a/razip.c b/razip.c index 2b49883..dff9347 100644 --- a/razip.c +++ b/razip.c @@ -27,7 +27,7 @@ static int write_open(const char *fn, int is_forced) int fd = -1; char c; if (!is_forced) { - if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644)) < 0 && errno == EEXIST) { + if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0666)) < 0 && errno == EEXIST) { printf("razip: %s already exists; do you wish to overwrite (y or n)? ", fn); scanf("%c", &c); if (c != 'Y' && c != 'y') { @@ -37,7 +37,7 @@ static int write_open(const char *fn, int is_forced) } } if (fd < 0) { - if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) { + if ((fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { fprintf(stderr, "razip: %s: Fail to write\n", fn); exit(1); }