Changeset 4954:537672d8fefb for attach.c

Show
Ignore:
Timestamp:
2007-03-02 21:12:33 (21 months ago)
Author:
Brendan Cully <brendan@…>
Children:
4955:2e4e1cc18c22, 5015:b9c0a75de5c0
Branch:
HEAD
Message:

Add $umask for mailboxes and attachments.

init.c could really use some refactoring.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • attach.c

    r4582 r4954  
    737737mutt_save_attachment_open (char *path, int flags) 
    738738{ 
     739  mode_t omask; 
     740  FILE *fp = NULL; 
     741 
     742  omask = umask(Umask); 
     743 
    739744  if (flags == M_SAVE_APPEND) 
    740     return fopen (path, "a"); 
    741   if (flags == M_SAVE_OVERWRITE) 
    742     return fopen (path, "w");           /* __FOPEN_CHECKED__ */ 
    743    
    744   return safe_fopen (path, "w"); 
     745    fp = fopen (path, "a"); 
     746  else if (flags == M_SAVE_OVERWRITE) 
     747    fp = fopen (path, "w");             /* __FOPEN_CHECKED__ */ 
     748  else 
     749    fp = safe_fopen (path, "w"); 
     750 
     751  umask(omask); 
     752 
     753  return fp; 
    745754} 
    746755