diff options
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/lib/cfuns-c.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f1944965..d1f605e7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2008-11-23 Gabriel Dos Reis <gdr@cs.tamu.edu> + * lib/cfuns-c.c (oa_copy_file): Specify permission mode for the + new file. + +2008-11-23 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/lodop.spad.pamphlet (OrdinaryDifferentialRing): Tidy. * algebra/sex.spad.pamphlet (SExpressionCategory): Fix breakage from last commit. diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c index 31cfff6e..bf3b7f7c 100644 --- a/src/lib/cfuns-c.c +++ b/src/lib/cfuns-c.c @@ -617,13 +617,14 @@ oa_copy_file(const char* src, const char* dst) return CopyFile(src,dst, /* bFailIfExists = */ 0) ? 0 : -1; #else #define OA_BUFSZ 512 +#define OA_DEFAULT_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) char buf[OA_BUFSZ]; int src_fd; int dst_fd; int count; if((src_fd = open(src, O_RDONLY)) < 0) return -1; - if ((dst_fd = open(dst, O_WRONLY | O_CREAT | O_TRUNC)) < 0) { + if ((dst_fd = creat(dst, OA_DEFAULT_MODE)) < 0) { close(src_fd); return -1; } @@ -632,6 +633,7 @@ oa_copy_file(const char* src, const char* dst) if (write(dst_fd, buf, count) != count) break; +#undef OA_DEFAULT_MODE #undef OA_BUFSZ return (close(dst_fd) < 0 || close(src_fd) < 0 || count < 0) ? -1 : 0; #endif |