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

Diff for /src/usr.bin/mg/dir.c between version 1.29 and 1.30

version 1.29, 2016/09/12 18:32:54 version 1.30, 2017/05/30 07:05:22
Line 117 
Line 117 
 {  {
         struct stat      sb;          struct stat      sb;
         int              finished, ishere;          int              finished, ishere;
         mode_t           dir_mode, mode, oumask;          mode_t           dir_mode, f_mode, oumask;
         char            *slash;          char            *slash;
   
         if ((path = adjustname(path, TRUE)) == NULL)          if ((path = adjustname(path, TRUE)) == NULL)
Line 131 
Line 131 
         slash = path;          slash = path;
   
         oumask = umask(0);          oumask = umask(0);
         mode = 0777 & ~oumask;          f_mode = 0777 & ~oumask;
         dir_mode = mode | S_IWUSR | S_IXUSR;          dir_mode = f_mode | S_IWUSR | S_IXUSR;
   
         for (;;) {          for (;;) {
                 slash += strspn(slash, "/");                  slash += strspn(slash, "/");
Line 152 
Line 152 
                         continue;                          continue;
                 }                  }
   
                 if (mkdir(path, finished ? mode : dir_mode) == 0) {                  if (mkdir(path, finished ? f_mode : dir_mode) == 0) {
                         if (mode > 0777 && chmod(path, mode) < 0) {                          if (f_mode > 0777 && chmod(path, f_mode) < 0) {
                                 umask(oumask);                                  umask(oumask);
                                 return (ABORT);                                  return (ABORT);
                         }                          }

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