[PATCH] strbuf_readlink semantics update.
- From
Pierre Habouzit <madcoder@debian.org>
- Date
- Dec 23, 2008, 10:05 UTC
- Message-ID
- <1230026749-25360-1-git-send-email-madcoder@debian.org>
- In-Reply-To
- <alpine.LFD.2.00.0812171042120.14014@localhost.localdomain>
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 <madcoder@debian.org> --- 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