From 9f443bc41e685cfa81a114d32152ee280816aa84 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 27 Dec 2007 19:41:40 +0000 Subject: [PATCH] properly end the string such that we don't get garbage in symlinks svn path=/main/branches/prefix/; revision=9057 --- src/chpathtool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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", -- 2.26.2