summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1627494)
raw | patch | inline | side by side (parent: 1627494)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 7 Nov 2013 06:48:59 +0000 (07:48 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 7 Nov 2013 06:48:59 +0000 (07:48 +0100) |
src/utils/strbuf.c | patch | blob | history |
diff --git a/src/utils/strbuf.c b/src/utils/strbuf.c
index 2b64480c55fc5960c816f83ef3a6b3bf626c1faf..4d8fc8b91ba234df10edd8d15d552169bcbf9930 100644 (file)
--- a/src/utils/strbuf.c
+++ b/src/utils/strbuf.c
ssize_t
sdb_strbuf_read(sdb_strbuf_t *strbuf, int fd, size_t n)
{
+ ssize_t ret;
+
if (! strbuf)
return -1;
if (strbuf_resize(strbuf, strbuf->pos + n + 1))
return -1;
- return read(fd, strbuf->string + strbuf->pos, n);
+ ret = read(fd, strbuf->string + strbuf->pos, n);
+ if (ret > 0)
+ strbuf->pos += (size_t)ret;
+ return ret;
} /* sdb_strbuf_read */
ssize_t