Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-28 17:30:08 -0400
committerDan McGee <dan@archlinux.org>2012-06-25 23:04:24 -0500
commit74274b5dc347ba70e4abd1f329feb41538f82ff4 (patch)
tree5750f0e41d16dabf70a321d40bb1cfc656da5ed2 /lib/libalpm/util.c
parent7245bc8e8e01149e076e820ea251f23839b1e0b2 (diff)
add real_line_size to alpm_read_buffer
We inevitably call strlen() or similar on the line returned from _alpm_archive_fgets(), so include the line size of the interesting line in the struct. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 996d7f4e..8fd7a100 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -1009,7 +1009,7 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
}
if(eol) {
- size_t len = (size_t)(eol - b->block_offset);
+ size_t len = b->real_line_size = (size_t)(eol - b->block_offset);
memcpy(b->line_offset, b->block_offset, len);
b->line_offset[len] = '\0';
b->block_offset = eol + 1;
@@ -1017,7 +1017,7 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
return ARCHIVE_OK;
} else {
/* we've looked through the whole block but no newline, copy it */
- size_t len = (size_t)(b->block + b->block_size - b->block_offset);
+ size_t len = b->real_line_size = (size_t)(b->block + b->block_size - b->block_offset);
memcpy(b->line_offset, b->block_offset, len);
b->line_offset += len;
b->block_offset = b->block + b->block_size;