Ticket #1010: UseMoveFileEx.diff
File UseMoveFileEx.diff, 1.5 KB (added by , 14 years ago) |
---|
-
lib/filesys.cpp
529 529 sprintf(cmd, "copy \"%s\" \"%s\"", orig, newf); 530 530 return system(cmd); 531 531 #else 532 // POSIX requires that shells run from an application will use the 533 // real UID and GID if different from the effective UID and GID. 534 // Mac OS 10.4 did not enforce this, but OS 10.5 does. Since 535 // system() invokes a shell, it may not properly copy the file's 536 // ownership or permissions when called from the BOINC Client 532 // POSIX requires that shells run from an application will use the 533 // real UID and GID if different from the effective UID and GID. 534 // Mac OS 10.4 did not enforce this, but OS 10.5 does. Since 535 // system() invokes a shell, it may not properly copy the file's 536 // ownership or permissions when called from the BOINC Client 537 537 // under sandbox security, so we copy the file directly. 538 538 FILE *src, *dst; 539 539 int m, n; … … 568 568 569 569 static int boinc_rename_aux(const char* old, const char* newf) { 570 570 #ifdef _WIN32 571 boinc_delete_file(newf);572 if (MoveFileA(old, newf))return 0;571 if (MoveFileExA(old, newf, MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) 572 return 0; 573 573 return GetLastError(); 574 574 #else 575 575 int retval = rename(old, newf); … … 723 723 #ifdef _WIN32 724 724 getcwd(path, 256); 725 725 #else 726 char* p 726 char* p 727 727 #ifdef __GNUC__ 728 728 __attribute__ ((unused)) 729 729 #endif