Add print_info.c example & fix deserialization
This commit is contained in:
@@ -46,6 +46,8 @@ deserialize_header(int fd, CommentHeader *header)
|
||||
int bytes_read;
|
||||
size_t len, dst_idx, i;
|
||||
|
||||
i = 0;
|
||||
|
||||
dst_bufs[0] = header->user_sid;
|
||||
dst_bufs[1] = header->user_displayname;
|
||||
dst_idx = 0;
|
||||
@@ -56,9 +58,8 @@ deserialize_header(int fd, CommentHeader *header)
|
||||
|
||||
while ((bytes_read = read(fd, buf, READ_BUF_SZ))) {
|
||||
for (; i < bytes_read; ++i) {
|
||||
if (buf[i] != '\0') {
|
||||
*(dst_bufs[dst_idx]++) = buf[i];
|
||||
} else {
|
||||
*(dst_bufs[dst_idx]++) = buf[i];
|
||||
if (buf[i] == '\0') {
|
||||
dst_idx++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user