Revision 2c993ec2 block/raw-win32.c
b/block/raw-win32.c | ||
---|---|---|
41 | 41 |
int qemu_ftruncate64(int fd, int64_t length) |
42 | 42 |
{ |
43 | 43 |
LARGE_INTEGER li; |
44 |
DWORD dw; |
|
44 | 45 |
LONG high; |
45 | 46 |
HANDLE h; |
46 | 47 |
BOOL res; |
... | ... | |
53 | 54 |
/* get current position, ftruncate do not change position */ |
54 | 55 |
li.HighPart = 0; |
55 | 56 |
li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT); |
56 |
if (li.LowPart == 0xffffffffUL && GetLastError() != NO_ERROR)
|
|
57 |
if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
|
|
57 | 58 |
return -1; |
59 |
} |
|
58 | 60 |
|
59 | 61 |
high = length >> 32; |
60 |
if (!SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN)) |
|
62 |
dw = SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN); |
|
63 |
if (dw == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { |
|
61 | 64 |
return -1; |
65 |
} |
|
62 | 66 |
res = SetEndOfFile(h); |
63 | 67 |
|
64 | 68 |
/* back to old position */ |
Also available in: Unified diff