/[mailutils]/mailutils/mailbox/mbx_mh.c
ViewVC logotype

Diff of /mailutils/mailbox/mbx_mh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by sroberts, Sun Dec 16 05:34:16 2001 UTC revision 1.19 by gray, Thu Jan 17 22:30:55 2002 UTC
# Line 50  Line 50 
50  #include <mailutils/header.h>  #include <mailutils/header.h>
51  #include <mailutils/attribute.h>  #include <mailutils/attribute.h>
52  #include <mailutils/error.h>  #include <mailutils/error.h>
53    #include <mailutils/mutil.h>
54  #include <registrar0.h>  #include <registrar0.h>
55  #include <mailbox0.h>  #include <mailbox0.h>
56    
# Line 447  _mh_next_seq (struct _mh_data *mhd) Line 448  _mh_next_seq (struct _mh_data *mhd)
448  static FILE *  static FILE *
449  _mh_tempfile(struct _mh_data *mhd, char **namep)  _mh_tempfile(struct _mh_data *mhd, char **namep)
450  {  {
451    char *filename;    int fd = mu_tempfile (mhd->name, namep);
   int fd;  
   
   filename = malloc (strlen (mhd->name) + /*'/'*/1 + /* "muXXXXXX" */8 + 1);  
   if (!filename)  
     return NULL;  
   sprintf (filename, "%s/muXXXXXX", mhd->name);  
   
 #ifdef HAVE_MKSTEMP  
   {  
     int save_mask = umask (077);  
     fd = mkstemp (filename);  
     umask (save_mask);  
   }  
 #else  
   if (mktemp (filename))  
     fd = open (filename, O_CREAT|O_EXCL|O_RDWR, 0600);  
   else  
     fd = -1;  
 #endif  
   
452    if (fd == -1)    if (fd == -1)
     {  
       free (filename);  
453        return NULL;        return NULL;
     }  
   
   *namep = filename;  
454    return fdopen (fd, "w");    return fdopen (fd, "w");
455  }  }
456    

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26