Annotation of /trunk/xorg-old/patches-6.9.0-r1/0128_all_4.2.0-imake-tmpdir-v2.patch
Parent Directory | Revision Log
Revision 167 -
(hide annotations)
(download)
Tue May 8 20:58:51 2007 UTC (17 years, 4 months ago) by niro
File size: 1062 byte(s)
Tue May 8 20:58:51 2007 UTC (17 years, 4 months ago) by niro
File size: 1062 byte(s)
-import
1 | niro | 167 | --- xc/config/imake/imake.c.orig 2001-12-14 20:53:18.000000000 +0100 |
2 | +++ xc/config/imake/imake.c 2003-09-12 15:00:10.000000000 +0200 | ||
3 | @@ -985,13 +985,23 @@ | ||
4 | static void | ||
5 | get_libc_version(FILE *inFile) | ||
6 | { | ||
7 | - char aout[] = "/tmp/imakeXXXXXX"; | ||
8 | + char aout[4096], *tmpdir; | ||
9 | FILE *fp; | ||
10 | const char *format = "%s -o %s -x c -"; | ||
11 | char *cc; | ||
12 | int len; | ||
13 | char *command; | ||
14 | |||
15 | + /* If $TMPDIR is defined and has an acceptable length, | ||
16 | + * use that as tmp dir, else use /tmp. That fixes | ||
17 | + * problems with /tmp mounted "noexec". | ||
18 | + */ | ||
19 | + if((tmpdir = getenv("TMPDIR")) != NULL && strlen(tmpdir) < (4096-13)) | ||
20 | + strcpy(aout, tmpdir); | ||
21 | + else | ||
22 | + strcpy(aout, "/tmp"); | ||
23 | + strcat(aout, "/imakeXXXXXX"); | ||
24 | + | ||
25 | /* Pre-create temp file safely */ | ||
26 | { | ||
27 | /* Linux + ELF has mkstemp() */ | ||
28 | @@ -1007,7 +1017,8 @@ | ||
29 | cc = "gcc"; | ||
30 | len = strlen (aout) + strlen (format) + strlen (cc); | ||
31 | if (len < 128) len = 128; | ||
32 | - command = alloca (len); | ||
33 | + if((command = alloca (len)) == NULL) | ||
34 | + abort(); | ||
35 | |||
36 | if (snprintf (command , len, format, cc, aout) == len) | ||
37 | abort (); |