From: Pierre Habouzit Date: Tue, 23 Dec 2008 10:05:49 GMT Subject: [PATCH] strbuf_readlink semantics update. Message-ID: <1230026749-25360-1-git-send-email-madcoder@debian.org> In-Reply-To: strbuf_* operations are meant to append their results to a current buffer rather than _replace_ its content. Modify strbuf_readlink accordingly. Current callers only operate on empty buffers at the moment and this semantic change doesn't break any current code. Signed-off-by: Pierre Habouzit --- strbuf.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/strbuf.c b/strbuf.c index bdf4954..254a7ee 100644 --- a/strbuf.c +++ b/strbuf.c @@ -299,12 +299,12 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) int len; strbuf_grow(sb, hint); - len = readlink(path, sb->buf, hint); + len = readlink(path, sb->buf + sb->len, hint); if (len < 0) { if (errno != ERANGE) break; } else if (len < hint) { - strbuf_setlen(sb, len); + strbuf_setlen(sb, sb->len + len); return 0; } -- 1.6.1.rc4.304.g3da087