index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <dreisner@archlinux.org> | 2012-07-19 10:37:56 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-08-01 08:53:10 -0500 |
commit | ddbd36103df95b3fbd199466f3203242ab9ed8f2 (patch) | |
tree | 8ead776c2c04483bc02ebc33e5e858831d7d75b4 /lib/libalpm/util.c | |
parent | 35ac4e7ef31898b4d8a090c687aad63df1436083 (diff) |
-rw-r--r-- | lib/libalpm/util.c | 6 |
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index c2b5d443..0196f3bb 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -1011,15 +1011,16 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b) } if(eol) { - size_t len = b->real_line_size = (size_t)(eol - b->block_offset); + size_t len = (size_t)(eol - b->block_offset); memcpy(b->line_offset, b->block_offset, len); b->line_offset[len] = '\0'; b->block_offset = eol + 1; + b->real_line_size = b->line_offset + len - b->line; /* this is the main return point; from here you can read b->line */ return ARCHIVE_OK; } else { /* we've looked through the whole block but no newline, copy it */ - size_t len = b->real_line_size = (size_t)(b->block + b->block_size - b->block_offset); + size_t len = (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; @@ -1027,6 +1028,7 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b) * returned on next call */ if(len == 0) { b->line_offset[0] = '\0'; + b->real_line_size = b->line_offset - b->line; return ARCHIVE_OK; } } |