Skip to content

Commit

Permalink
file-copy: always rename temp-file to target.
Browse files Browse the repository at this point in the history
  • Loading branch information
lavv17 committed Oct 27, 2014
1 parent 752df38 commit b1164d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FileCopy.cc
Expand Up @@ -1516,7 +1516,7 @@ int FileCopyPeerFDStream::Do()
{
const char *new_name=dir_file(dirname(stream->full_name),suggested_filename);
struct stat st;
if((lstat(new_name,&st)==-1 && errno==ENOENT) || ResMgr::QueryBool("xfer:clobber",0)) {
if(temp_file || (lstat(new_name,&st)==-1 && errno==ENOENT) || ResMgr::QueryBool("xfer:clobber",0)) {
debug((5,"copy: renaming `%s' to `%s'\n",stream->full_name.get(),suggested_filename.get()));
if(rename(stream->full_name,new_name)==-1) {
const char *err=xstring::format("rename(%s, %s): %s\n",stream->full_name.get(),new_name,strerror(errno));
Expand Down

0 comments on commit b1164d6

Please sign in to comment.