mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-02-01 02:32:04 -05:00
changed the name of the temporary filename to include a leading . so
that it appears hidden while being transferred. This should be useful when using rsync for mirroring so users accessing via ftp don't get confused by the temporary files.
This commit is contained in:
23
rsync.c
23
rsync.c
@@ -818,12 +818,6 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
|
||||
}
|
||||
|
||||
/* open tmp file */
|
||||
if (strlen(fname) > (MAXPATHLEN-8)) {
|
||||
rprintf(FERROR,"filename too long\n");
|
||||
if (buf) unmap_file(buf);
|
||||
close(fd1);
|
||||
continue;
|
||||
}
|
||||
if (tmpdir) {
|
||||
char *f;
|
||||
f = strrchr(fname,'/');
|
||||
@@ -831,9 +825,22 @@ int recv_files(int f_in,struct file_list *flist,char *local_name,int f_gen)
|
||||
f = fname;
|
||||
else
|
||||
f++;
|
||||
sprintf(fnametmp,"%s/%s.XXXXXX",tmpdir,f);
|
||||
if (strlen(tmpdir)+strlen(f)+10 > MAXPATHLEN) {
|
||||
rprintf(FERROR,"filename too long\n");
|
||||
if (buf) unmap_file(buf);
|
||||
close(fd1);
|
||||
continue;
|
||||
}
|
||||
sprintf(fnametmp,"%s/.%s.XXXXXX",tmpdir,f);
|
||||
} else {
|
||||
sprintf(fnametmp,"%s.XXXXXX",fname);
|
||||
if (strlen(fname)+9 > MAXPATHLEN) {
|
||||
rprintf(FERROR,"filename too long\n");
|
||||
if (buf) unmap_file(buf);
|
||||
close(fd1);
|
||||
continue;
|
||||
}
|
||||
|
||||
sprintf(fnametmp,".%s.XXXXXX",fname);
|
||||
}
|
||||
if (NULL == do_mktemp(fnametmp)) {
|
||||
rprintf(FERROR,"mktemp %s failed\n",fnametmp);
|
||||
|
||||
Reference in New Issue
Block a user