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

Diff for /src/usr.bin/tmux/tmux.c between version 1.207 and 1.208

version 1.207, 2021/06/10 07:52:29 version 1.208, 2021/07/06 08:26:00
Line 211 
Line 211 
         free(paths);          free(paths);
   
         xasprintf(&base, "%s/tmux-%ld", path, (long)uid);          xasprintf(&base, "%s/tmux-%ld", path, (long)uid);
         if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)          if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST) {
                   xasprintf(cause, "couldn't create directory %s (%s)", base,
                       strerror(errno));
                 goto fail;                  goto fail;
         if (lstat(base, &sb) != 0)          }
           if (lstat(base, &sb) != 0) {
                   xasprintf(cause, "couldn't read directory %s (%s)", base,
                       strerror(errno));
                 goto fail;                  goto fail;
           }
         if (!S_ISDIR(sb.st_mode)) {          if (!S_ISDIR(sb.st_mode)) {
                 errno = ENOTDIR;                  xasprintf(cause, "%s is not a directory", base);
                 goto fail;                  goto fail;
         }          }
         if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) {          if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) {
                 errno = EACCES;                  xasprintf(cause, "directory %s has unsafe permissions", base);
                 goto fail;                  goto fail;
         }          }
         xasprintf(&path, "%s/%s", base, label);          xasprintf(&path, "%s/%s", base, label);
Line 228 
Line 234 
         return (path);          return (path);
   
 fail:  fail:
         xasprintf(cause, "error creating %s (%s)", base, strerror(errno));  
         free(base);          free(base);
         return (NULL);          return (NULL);
 }  }

Legend:
Removed from v.1.207  
changed lines
  Added in v.1.208