Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GNU screen: A patch to avoid /tmp/uscreens permission check on Cygwin
diff --git a/src/screen.c b/src/screen.c
index 6e19732..3a8ca3e 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1102,8 +1102,10 @@ char **av;
n = (eff_uid == 0 && (real_uid || (st.st_mode & 0775) != 0775)) ? 0755 :
(eff_gid == (int)st.st_gid && eff_gid != real_gid) ? 0775 :
+#if !defined(__CYGWIN__)
if (((int)st.st_mode & 0777) != n)
Panic(0, "Directory '%s' must have mode %03o.", SockDir, n);
sprintf(SockPath, "%s/S-%s", SockDir, LoginName);
if (access(SockPath, F_OK))
@@ -1133,8 +1135,10 @@ char **av;
if ((int)st.st_uid != real_uid)
Panic(0, "You are not the owner of %s.", SockPath);
+#if !defined(__CYGWIN__)
if ((st.st_mode & 0777) != 0700)
Panic(0, "Directory %s must have mode 700.", SockPath);
if (SockMatch && index(SockMatch, '/'))
Panic(0, "Bad session name '%s'", SockMatch);
SockName = SockPath + strlen(SockPath) + 1;

This comment has been minimized.

Copy link

@franklinchou franklinchou commented Jul 1, 2013

Love the idea. Two points I'd like to make.

  1. I downloaded this and attempted to patch the source. The process is roughly: get the source file from the Cygwin setup.exe, navigate to /usr/src/screen. issue patch -p1 -d /path/to/src /path/to/patch. When prompted for a file provide screen.c and patch should complete. Following this I got a wide variety of other errors and gave up. So I never figured out if this works. I will star it, for the author. If anyone can get the patched source past the ./configure script please let me know
  2. After abandoning this patch there is a workaround. I describe it here:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.