[BACK]Return to util.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / patch

Diff for /src/usr.bin/patch/util.c between version 1.29 and 1.30

version 1.29, 2004/11/19 20:00:57 version 1.30, 2005/05/16 15:22:46
Line 49 
Line 49 
 #include "backupfile.h"  #include "backupfile.h"
 #include "pathnames.h"  #include "pathnames.h"
   
   
 /* Rename a file, copying it if necessary. */  /* Rename a file, copying it if necessary. */
   
 int  int
Line 308 
Line 307 
 makedirs(const char *filename, bool striplast)  makedirs(const char *filename, bool striplast)
 {  {
         char    *tmpbuf;          char    *tmpbuf;
           mode_t mode, dir_mode;
   
         if ((tmpbuf = strdup(filename)) == NULL)          if ((tmpbuf = strdup(filename)) == NULL)
                 fatal("out of memory\n");                  fatal("out of memory\n");
Line 318 
Line 318 
                         return; /* nothing to be done */                          return; /* nothing to be done */
                 *s = '\0';                  *s = '\0';
         }          }
         if (snprintf(buf, sizeof(buf), "%s -p %s", _PATH_MKDIR, tmpbuf)          mode = 0777 & ~umask(0);
             >= sizeof(buf))          dir_mode = mode | S_IWUSR | S_IXUSR;
                 fatal("buffer too small to hold %.20s...\n", tmpbuf);          if (mkpath(tmpbuf, mode, dir_mode) != 0)
                   pfatal("creation of %s failed", tmpbuf);
         if (system(buf))          free(tmpbuf);
                 pfatal("%.40s failed", buf);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30