- client (unix): rename() doesn't work between filesystems.

If the user has set things up so that slots/ is a symlink
    to a different filesystem, things won't work when the client
    moves output files from the slot to project dir.
    Solution: if rename() fails, try system("mv ...")
    since mv works across filesystems
This commit is contained in:
David Anderson 2012-12-07 12:42:38 -08:00 committed by Oliver Bock
parent ca8afde85b
commit c1f63276ee
2 changed files with 19 additions and 0 deletions

View File

@ -7361,3 +7361,14 @@ David 7 Dec 2012
clientgui/
AsyncRPC.cpp
stdwx.h
David 7 Dec 2012
- client (unix): rename() doesn't work between filesystems.
If the user has set things up so that slots/ is a symlink
to a different filesystem, things won't work when the client
moves output files from the slot to project dir.
Solution: if rename() fails, try system("mv ...")
since mv works across filesystems
lib/
filesys.cpp

View File

@ -594,7 +594,15 @@ static int boinc_rename_aux(const char* old, const char* newf) {
if (MoveFileExA(old, newf, MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH)) return 0;
return GetLastError();
#else
// rename() doesn't work between filesystems.
// So if it fails, try the "mv" command, which does work
//
int retval = rename(old, newf);
if (retval) {
char buf[MAXPATHLEN+MAXPATHLEN];
sprintf(buf, "mv \"%s\" \"%s\"", old, newf);
retval = system(buf);
}
if (retval) return ERR_RENAME;
return 0;
#endif