ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
zlib/zutil.o zlib/adler32.o
-OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o main.o checksum.o match.o syscall.o log.o
+OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o main.o checksum.o match.o syscall.o log.o backup.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o fileio.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
OBJS=$(OBJS1) $(OBJS2) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ)
--- /dev/null
+/*
+ Copyright (C) Andrew Tridgell 1999
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* backup handling code */
+
+#include "rsync.h"
+
+extern int verbose;
+extern char *backup_suffix;
+
+
+int make_backup(char *fname)
+{
+ char fnamebak[MAXPATHLEN];
+ if (strlen(fname) + strlen(backup_suffix) > (MAXPATHLEN-1)) {
+ rprintf(FERROR,"backup filename too long\n");
+ return 0;
+ }
+
+ slprintf(fnamebak,sizeof(fnamebak),"%s%s",fname,backup_suffix);
+ if (do_rename(fname,fnamebak) != 0) {
+ /* cygwin (at least version b19) reports EINVAL */
+ if (errno != ENOENT && errno != EINVAL) {
+ rprintf(FERROR,"rename %s %s : %s\n",fname,fnamebak,strerror(errno));
+ return 0;
+ }
+ } else if (verbose > 1) {
+ rprintf(FINFO,"backed up %s to %s\n",fname,fnamebak);
+ }
+ return 1;
+}
extern int preserve_gid;
extern int preserve_perms;
extern int make_backups;
-extern char *backup_suffix;
/*
exit_cleanup(RERR_SIGNAL);
}
-int make_backup(char *fname)
-{
- char fnamebak[MAXPATHLEN];
- if (strlen(fname) + strlen(backup_suffix) > (MAXPATHLEN-1)) {
- rprintf(FERROR,"backup filename too long\n");
- return 0;
- }
-
- slprintf(fnamebak,sizeof(fnamebak),"%s%s",fname,backup_suffix);
- if (do_rename(fname,fnamebak) != 0) {
- /* cygwin (at least version b19) reports EINVAL */
- if (errno != ENOENT && errno != EINVAL) {
- rprintf(FERROR,"rename %s %s : %s\n",fname,fnamebak,strerror(errno));
- return 0;
- }
- } else if (verbose > 1) {
- rprintf(FINFO,"backed up %s to %s\n",fname,fnamebak);
- }
- return 1;
-}
-
/* finish off a file transfer, renaming the file and setting the permissions
and ownership */