diff options
Diffstat (limited to 'net-misc/vnc/files/vnc-4.0/imake-tmpdir.patch')
-rw-r--r-- | net-misc/vnc/files/vnc-4.0/imake-tmpdir.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/net-misc/vnc/files/vnc-4.0/imake-tmpdir.patch b/net-misc/vnc/files/vnc-4.0/imake-tmpdir.patch new file mode 100644 index 000000000000..209cb15bf543 --- /dev/null +++ b/net-misc/vnc/files/vnc-4.0/imake-tmpdir.patch @@ -0,0 +1,37 @@ +--- xc/config/imake/imake.c.orig 2001-12-14 20:53:18.000000000 +0100 ++++ xc/config/imake/imake.c 2003-09-12 15:00:10.000000000 +0200 +@@ -985,13 +985,23 @@ + static void + get_libc_version(FILE *inFile) + { +- char aout[] = "/tmp/imakeXXXXXX"; ++ char aout[4096], *tmpdir; + FILE *fp; + const char *format = "%s -o %s -x c -"; + char *cc; + int len; + char *command; + ++ /* If $TMPDIR is defined and has an acceptable length, ++ * use that as tmp dir, else use /tmp. That fixes ++ * problems with /tmp mounted "noexec". ++ */ ++ if((tmpdir = getenv("TMPDIR")) != NULL && strlen(tmpdir) < (4096-13)) ++ strcpy(aout, tmpdir); ++ else ++ strcpy(aout, "/tmp"); ++ strcat(aout, "/imakeXXXXXX"); ++ + /* Pre-create temp file safely */ + { + /* Linux + ELF has mkstemp() */ +@@ -1007,7 +1017,8 @@ + cc = "gcc"; + len = strlen (aout) + strlen (format) + strlen (cc); + if (len < 128) len = 128; +- command = alloca (len); ++ if((command = alloca (len)) == NULL) ++ abort(); + + if (snprintf (command , len, format, cc, aout) == len) + abort (); |