Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-alt r1642 - trunk/toolchain-prefix-wrapper/ld
Date: Sat, 21 Mar 2009 13:33:36
Message-Id: E1Ll1KP-0001ea-Im@stork.gentoo.org
1 Author: grobian
2 Date: 2009-03-21 13:33:33 +0000 (Sat, 21 Mar 2009)
3 New Revision: 1642
4
5 Modified:
6 trunk/toolchain-prefix-wrapper/ld/gnuplugin.c
7 Log:
8 A compiling version of the previous patch, copy string if need to, since we can't write in read-only defined strings
9
10 Modified: trunk/toolchain-prefix-wrapper/ld/gnuplugin.c
11 ===================================================================
12 --- trunk/toolchain-prefix-wrapper/ld/gnuplugin.c 2009-03-21 13:14:16 UTC (rev 1641)
13 +++ trunk/toolchain-prefix-wrapper/ld/gnuplugin.c 2009-03-21 13:33:33 UTC (rev 1642)
14 @@ -13,6 +13,7 @@
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 #include <unistd.h>
18 +#include <alloca.h>
19
20 #if defined(__cplusplus)
21 extern "C" {
22 @@ -90,14 +91,14 @@
23 if (curr == argBuffer && rpathArg == _R) {
24 struct stat sbuf;
25 int rv;
26 - char colon = *next == ':';
27 - /* terminate the string in case of ':' */
28 - if (colon)
29 - *next = '\0';
30 - rv = stat(curr, &sbuf);
31 - /* uncut string again */
32 - if (colon)
33 - *next = ':';
34 + char *path = curr;
35 + if (*next == ':') {
36 + /* terminate the string in case of ':' */
37 + path = alloca(sizeof(char) * (next - curr + 1));
38 + memcpy(path, curr, next - curr);
39 + path[next - curr] = '\0';
40 + }
41 + rv = stat(path, &sbuf);
42 /* if argument to "-R" is not a directory, then
43 * it is not a rpath, make sure we push out the
44 * entire argument in that case, and not just