Skip to content
Snippets Groups Projects
Commit 31149a20 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Always use rename() on *nix when mv() is called with copy=FALSE

This should fix issue #272 reported by Ragnarok. Not the libarchive error part, but the second (mv) CopyFile error part.
parent e2004b91
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2365 passed
...@@ -3948,9 +3948,11 @@ int sbbs_t::mv(char *src, char *dest, char copy) ...@@ -3948,9 +3948,11 @@ int sbbs_t::mv(char *src, char *dest, char copy)
,dest); ,dest);
return(-1); return(-1);
} }
if(!copy
#ifndef __unix__ /* need to determine if on same mount device */ #ifndef __unix__ /* need to determine if on same mount device */
if(!copy && ((src[1]!=':' && dest[1]!=':') && ((src[1]!=':' && dest[1]!=':') || (src[1]==':' && dest[1]==':' && toupper(src[0])==toupper(dest[0])))
|| (src[1]==':' && dest[1]==':' && toupper(src[0])==toupper(dest[0])))) { #endif
) {
if(rename(src,dest)) { /* same drive, so move */ if(rename(src,dest)) { /* same drive, so move */
bprintf("\r\nMV ERROR: Error renaming '%s'" bprintf("\r\nMV ERROR: Error renaming '%s'"
"\r\n to '%s'\r\n\7",src,dest); "\r\n to '%s'\r\n\7",src,dest);
...@@ -3958,7 +3960,6 @@ int sbbs_t::mv(char *src, char *dest, char copy) ...@@ -3958,7 +3960,6 @@ int sbbs_t::mv(char *src, char *dest, char copy)
} }
return(0); return(0);
} }
#endif
if(!CopyFile(src, dest, /* fail if exists: */true)) { if(!CopyFile(src, dest, /* fail if exists: */true)) {
errormsg(WHERE, "CopyFile", src, 0, dest); errormsg(WHERE, "CopyFile", src, 0, dest);
return -1; return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment