Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't show basedir in printed path (a aesthetic change only)
[rsync/rsync.git]
/
util.c
diff --git
a/util.c
b/util.c
index
15cf2bc
..
4d293f2
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-170,24
+170,28
@@
void out_of_memory(char *str)
int set_modtime(char *fname,time_t modtime)
{
int set_modtime(char *fname,time_t modtime)
{
+ extern int dry_run;
+ if (dry_run) return 0;
+ {
#ifdef HAVE_UTIMBUF
#ifdef HAVE_UTIMBUF
- struct utimbuf tbuf;
- tbuf.actime = time(NULL);
- tbuf.modtime = modtime;
- return utime(fname,&tbuf);
+
struct utimbuf tbuf;
+
tbuf.actime = time(NULL);
+
tbuf.modtime = modtime;
+
return utime(fname,&tbuf);
#elif defined(HAVE_UTIME)
#elif defined(HAVE_UTIME)
- time_t t[2];
- t[0] = time(NULL);
- t[1] = modtime;
- return utime(fname,t);
+
time_t t[2];
+
t[0] = time(NULL);
+
t[1] = modtime;
+
return utime(fname,t);
#else
#else
- struct timeval t[2];
- t[0].tv_sec = time(NULL);
- t[0].tv_usec = 0;
- t[1].tv_sec = modtime;
- t[1].tv_usec = 0;
- return utimes(fname,t);
+
struct timeval t[2];
+
t[0].tv_sec = time(NULL);
+
t[0].tv_usec = 0;
+
t[1].tv_sec = modtime;
+
t[1].tv_usec = 0;
+
return utimes(fname,t);
#endif
#endif
+ }
}
}
@@
-310,13
+314,13
@@
int copy_file(char *source, char *dest, mode_t mode)
return -1;
}
return -1;
}
- if (unlink(dest) && errno != ENOENT) {
+ if (
do_
unlink(dest) && errno != ENOENT) {
fprintf(FERROR,"unlink %s: %s\n",
dest,strerror(errno));
return -1;
}
fprintf(FERROR,"unlink %s: %s\n",
dest,strerror(errno));
return -1;
}
- ofd = open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
+ ofd =
do_
open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
if (ofd < 0) {
fprintf(FERROR,"open %s: %s\n",
dest,strerror(errno));
if (ofd < 0) {
fprintf(FERROR,"open %s: %s\n",
dest,strerror(errno));