]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: fix bug in bsubst
authorAlex Brainman <alex.brainman@gmail.com>
Sun, 5 Feb 2012 04:16:39 +0000 (15:16 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Sun, 5 Feb 2012 04:16:39 +0000 (15:16 +1100)
R=golang-dev, r, dsymonds, akumar
CC=golang-dev
https://golang.org/cl/5624054

src/cmd/dist/buf.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index c990c8a..45fb195
@@ -115,8 +115,11 @@ bsubst(Buf *b, char *x, char *y)
                if(p == nil)
                        break;
                if(nx != ny) {
-                       if(nx < ny)
+                       if(nx < ny) {
+                               pos = p - b->p;
                                bgrow(b, ny-nx);
+                               p = b->p + pos;
+                       }
                        xmemmove(p+ny, p+nx, (b->p+b->len)-(p+nx));
                }
                xmemmove(p, y, ny);