Package: tmux
Version: 2.8-3
Severity: normal
Tags: upstream patch

Hello,

Starting with a running tmux session that is attachable as expected:

        uwe@taurus:~$ chmod o+x /tmp/tmux-$(id -u)
        uwe@taurus:~$ tmux a
        error creating /tmp/tmux-1000 (Permission denied)

This error message is misleading, as the directory exists just fine.

unstable and experimental are also affected.

To improve this, the following patch helps:

diff --git a/tmux.c b/tmux.c
index 5b73079ee7b3..f11e5dc56136 100644
--- a/tmux.c
+++ b/tmux.c
@@ -134,12 +134,12 @@ make_label(const char *label, char **cause)
        if (lstat(resolved, &sb) != 0)
                goto fail;
        if (!S_ISDIR(sb.st_mode)) {
-               errno = ENOTDIR;
-               goto fail;
+               xasprintf(cause, "%s is not a directory", resolved);
+               return NULL;
        }
        if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) {
-               errno = EACCES;
-               goto fail;
+               xasprintf(cause, "unsafe permissions for %s", resolved);
+               return NULL;
        }
        xasprintf(&path, "%s/%s", resolved, label);
        return (path);

Best regards
Uwe

Reply via email to