diff options
author | Thomas Adam <thomas@xteddy.org> | 2021-07-06 10:01:22 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2021-07-06 10:01:22 +0100 |
commit | ed575182e3018d81a0b3b81bde4a64bad967c298 (patch) | |
tree | 833ec8dbcfbdf27ee247af05c3eae6887dc6ef56 /tmux.c | |
parent | b1a8c0fe022e99cffb0fb4f321740464f35bc6b9 (diff) | |
parent | 32f2d9d089ced7d693aa412821f1d66134877cf0 (diff) | |
download | rtmux-ed575182e3018d81a0b3b81bde4a64bad967c298.tar.gz rtmux-ed575182e3018d81a0b3b81bde4a64bad967c298.tar.bz2 rtmux-ed575182e3018d81a0b3b81bde4a64bad967c298.zip |
Merge branch 'obsd-master' into master
Diffstat (limited to 'tmux.c')
-rw-r--r-- | tmux.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -207,16 +207,22 @@ make_label(const char *label, char **cause) free(paths); 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; - if (lstat(base, &sb) != 0) + } + if (lstat(base, &sb) != 0) { + xasprintf(cause, "couldn't read directory %s (%s)", base, + strerror(errno)); goto fail; + } if (!S_ISDIR(sb.st_mode)) { - errno = ENOTDIR; + xasprintf(cause, "%s is not a directory", base); goto fail; } if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) { - errno = EACCES; + xasprintf(cause, "directory %s has unsafe permissions", base); goto fail; } xasprintf(&path, "%s/%s", base, label); @@ -224,7 +230,6 @@ make_label(const char *label, char **cause) return (path); fail: - xasprintf(cause, "error creating %s (%s)", base, strerror(errno)); free(base); return (NULL); } |