aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-05-22 14:33:51 +0200
committerThomas White <taw@physics.org>2014-05-22 14:33:51 +0200
commit8c76ffc087dc1f900125b8669d3460b7ea52f14c (patch)
tree2158ff00a46c224e8a1389ee1f7a0b874d169470
parent947fb90facb9afd6b5bbc1e7762644c073955a71 (diff)
Fix permissions of newly created stream files
The user's umask should prevent all the streams from being (eg) world writable.
-rw-r--r--libcrystfel/src/stream.c4
-rw-r--r--src/indexamajig.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index a0d849a8..fa893a30 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -863,12 +863,12 @@ Stream *open_stream_fd_for_write(int fd)
}
-
Stream *open_stream_for_write(const char *filename)
{
int fd;
- fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
+ fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if ( fd == -1 ) {
ERROR("Failed to open stream.\n");
return NULL;
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 143a0d82..9102ccc5 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -627,7 +627,8 @@ int main(int argc, char *argv[])
}
- ofd = open(outfile, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
+ ofd = open(outfile, O_CREAT | O_TRUNC | O_WRONLY,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if ( ofd == -1 ) {
ERROR("Failed to open stream '%s'\n", outfile);
return 1;