corrected assignments.

This commit is contained in:
nvt-se 2008-09-21 15:30:51 +00:00
parent ac6ce4cbf1
commit 9e7add658b

View file

@ -794,13 +794,13 @@ cfs_open(const char *name, int flags)
} else { } else {
READ_HEADER(&hdr, page); READ_HEADER(&hdr, page);
if(COFFEE_PAGE_MODIFIED(hdr)) { if(COFFEE_PAGE_MODIFIED(hdr)) {
coffee_fd_set[fd].flags |= COFFEE_FD_MODIFIED; coffee_fd_set[fd].flags = COFFEE_FD_MODIFIED;
} } else
coffee_fd_set[fd].max_pages = hdr.max_pages; coffee_fd_set[fd].max_pages = hdr.max_pages;
} }
coffee_fd_set[fd].file_page = page; coffee_fd_set[fd].file_page = page;
coffee_fd_set[fd].flags = flags; coffee_fd_set[fd].flags |= flags;
coffee_fd_set[fd].end = find_offset_in_file(page); coffee_fd_set[fd].end = find_offset_in_file(page);
coffee_fd_set[fd].offset = flags & CFS_APPEND ? coffee_fd_set[fd].end : 0; coffee_fd_set[fd].offset = flags & CFS_APPEND ? coffee_fd_set[fd].end : 0;
coffee_fd_set[fd].next_log_entry = 0; coffee_fd_set[fd].next_log_entry = 0;
@ -890,6 +890,10 @@ cfs_read(int fd, void *buf, unsigned size)
size = fdp->end - fdp->offset; size = fdp->end - fdp->offset;
} }
if(FD_MODIFIED(fd)) {
READ_HEADER(&hdr, fdp->file_page);
}
remains = size; remains = size;
base = fdp->offset; base = fdp->offset;
offset = 0; offset = 0;
@ -904,7 +908,6 @@ cfs_read(int fd, void *buf, unsigned size)
lp.offset = base + offset; lp.offset = base + offset;
lp.buf = (char *)buf + offset; lp.buf = (char *)buf + offset;
lp.size = remains; lp.size = remains;
READ_HEADER(&hdr, fdp->file_page);
r = read_log_page(&hdr, r = read_log_page(&hdr,
fdp->next_log_entry > 0 ? fdp->next_log_entry - 1 : -1, &lp); fdp->next_log_entry > 0 ? fdp->next_log_entry - 1 : -1, &lp);
if(r >= 0) { if(r >= 0) {