Add print_info.c example & fix deserialization

This commit is contained in:
2023-06-15 21:18:19 +03:00
parent f713a18efa
commit 509dd9ec01
3 changed files with 91 additions and 6 deletions

View File

@@ -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++;
}
}