Set the file mode creation default to user only.
authorFrancois Fleuret <francois@fleuret.org>
Tue, 29 Jul 2014 10:40:31 +0000 (12:40 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Tue, 29 Jul 2014 10:40:31 +0000 (12:40 +0200)
mymail.c

index a584e48..29f0634 100644 (file)
--- a/mymail.c
+++ b/mymail.c
@@ -37,6 +37,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 #include <string.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -380,6 +381,7 @@ void extract_mail(const char *mail_filename, unsigned long int position_in_mail,
   /* printf("Extract\n"); */
 
   mail_file = safe_fopen(mail_filename, "r", "mbox for mail extraction");
+  /* fchmod(fileno(mail_file), 0x660); */
   fseek(mail_file, position_in_mail, SEEK_SET);
 
   if(fgets(raw_mbox_line, BUFFER_SIZE, mail_file)) {
@@ -1056,6 +1058,9 @@ int main(int argc, char **argv) {
   struct search_condition search_conditions[MAX_NB_SEARCH_CONDITIONS];
   struct alias_node *a, *b;
 
+  /* Group and others have no access */
+  umask(S_IRWXG | S_IRWXO);
+
   if(regcomp(&global_leading_from_line_regexp, LEADING_FROM_LINE_REGEXP_STRING, 0)) {
     fprintf(stderr,
             "mymail: Cannot compile leading \"from\" line regexp. That is strange.\n");