minimig: Fix ACTION_SEEK when offset is negative

Some applications would fail to load some files due to negative seek
offsets being corrupted by unsigned conversion.

A simple test case is AmigaGuide: place an AmigaGuide document on the
shared volume and attempt to open it. Before this patch, this would fail
silently.
This commit is contained in:
Dale Whinham
2020-12-11 19:29:41 +00:00
parent c8a124385e
commit 23a5258e37

View File

@@ -591,10 +591,10 @@ static int process_request(void *reqres_buffer)
break;
}
uint32_t old_pos = open_file_handles[key].offset;
int old_pos = open_file_handles[key].offset;
uint32_t new_pos = SWAP_INT(req->new_pos);
uint32_t mode = SWAP_INT(req->mode);
int new_pos = SWAP_INT(req->new_pos);
int mode = SWAP_INT(req->mode);
int origin = SEEK_SET;
if (mode == OFFSET_CURRENT) origin = SEEK_CUR;