diff --git a/checkin_notes b/checkin_notes index e5276c2941..6b8d9d65ba 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/lib/filesys.cpp b/lib/filesys.cpp index 62385839d0..2c5d50eb8a 100644 --- a/lib/filesys.cpp +++ b/lib/filesys.cpp @@ -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