From: Fabian Groffen Date: Thu, 27 Dec 2007 19:41:40 +0000 (-0000) Subject: properly end the string such that we don't get garbage in symlinks X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=9f443bc41e685cfa81a114d32152ee280816aa84;p=portage.git properly end the string such that we don't get garbage in symlinks svn path=/main/branches/prefix/; revision=9057 --- diff --git a/src/chpathtool.c b/src/chpathtool.c index 6f6960afe..0aa07c381 100644 --- a/src/chpathtool.c +++ b/src/chpathtool.c @@ -239,7 +239,7 @@ int dirwalk(char *src, char *srcp, char *trg, char *trgp) { ) { /* FIXME: handle hard links! (keep track of files with >1 - * refs, match those with a list of known files */ + * refs, match those with a list of known files with count >1 */ /* copy */ if (chpath(src, trg) != 0) { @@ -309,7 +309,9 @@ int dirwalk(char *src, char *srcp, char *trg, char *trgp) { pr += valuelen; pb += magiclen; } - memcpy(pr, pb, (&buf[0] + len) - pb); + len = (&buf[0] + len) - pb; + memcpy(pr, pb, len); + pr[len] = '\0'; if (symlink(rep, trg) != 0) { fprintf(stderr, "failed to create symlink %s -> %s: %s\n",