]> Cypherpunks repositories - gostls13.git/commitdiff
ld: handle quoted spaces in package path
authorDan Sinclair <dan.sinclair@gmail.com>
Fri, 10 Sep 2010 17:59:20 +0000 (13:59 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 10 Sep 2010 17:59:20 +0000 (13:59 -0400)
Fixes #1087.

R=rsc
CC=golang-dev
https://golang.org/cl/2172041

src/cmd/ld/go.c

index 46ae5ff74d21e9abcf460309452ff8ca722199ee..e0ea6091f0121858f51add642187a05d65704821 100644 (file)
@@ -282,7 +282,7 @@ static int
 parsepkgdata(char *file, char *pkg, char **pp, char *ep, char **prefixp, char **namep, char **defp)
 {
        char *p, *prefix, *name, *def, *edef, *meth;
-       int n;
+       int n, inquote;
 
        // skip white space
        p = *pp;
@@ -319,8 +319,19 @@ loop:
 
        // name: a.b followed by space
        name = p;
-       while(p < ep && *p != ' ')
+       inquote = 0;
+       while(p < ep) {
+               if (*p == ' ' && !inquote)
+                       break;
+
+                if(*p == '\\')
+                        p++;
+               else if(*p == '"')
+                       inquote = !inquote;
+
                p++;
+       }
+
        if(p >= ep)
                return -1;
        *p++ = '\0';