VM: fix so that errno is set if MoveFileEx fails, should fix #1490
parent
37cd54cfbb
commit
575da3e478
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2010 Doug Coleman.
|
! Copyright (C) 2010 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: combinators continuations io.backend io.directories io.files
|
USING: combinators continuations io.backend io.directories io.files
|
||||||
io.files.temp io.files.windows io.pathnames kernel memory sequences
|
io.files.temp io.files.windows io.pathnames kernel kernel.private libc
|
||||||
splitting tools.test windows.kernel32 ;
|
literals memory sequences splitting tools.test windows.kernel32 ;
|
||||||
IN: io.files.windows.tests
|
IN: io.files.windows.tests
|
||||||
|
|
||||||
[ f ] [ "\\foo" absolute-path? ] unit-test
|
[ f ] [ "\\foo" absolute-path? ] unit-test
|
||||||
|
@ -68,7 +68,7 @@ IN: io.files.windows.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! set-file-attributes & save-image
|
! set-file-attributes & save-image
|
||||||
{ { "kernel-error" 1 13 f } } [
|
{ ${ "kernel-error" ERROR-IO EIO f } } [
|
||||||
[
|
[
|
||||||
"read-only.image" temp-file {
|
"read-only.image" temp-file {
|
||||||
[ ?delete-file ]
|
[ ?delete-file ]
|
||||||
|
|
|
@ -137,9 +137,18 @@ long getpagesize() {
|
||||||
return g_pagesize;
|
return g_pagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveFileEx returns FALSE on fail
|
|
||||||
bool move_file(const vm_char* path1, const vm_char* path2) {
|
bool move_file(const vm_char* path1, const vm_char* path2) {
|
||||||
return !(MoveFileEx((path1), (path2), MOVEFILE_REPLACE_EXISTING) == FALSE);
|
/* MoveFileEx returns FALSE on fail. */
|
||||||
|
BOOL val = MoveFileEx((path1), (path2), MOVEFILE_REPLACE_EXISTING);
|
||||||
|
if (val == FALSE) {
|
||||||
|
/* MoveFileEx doesn't set errno, which primitive_save_image()
|
||||||
|
reads the error code from. Instead of converting from
|
||||||
|
GetLastError() to errno values, we ust set it to the generic
|
||||||
|
EIO value. */
|
||||||
|
errno = EIO;
|
||||||
|
}
|
||||||
|
return val == TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void factor_vm::init_signals() {}
|
void factor_vm::init_signals() {}
|
||||||
|
|
Loading…
Reference in New Issue