summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-03-31 07:46:47 -0700
committerWayne Davison <wayned@samba.org>2008-03-31 07:46:47 -0700
commit5b83829669d9c7e276aeaf8027e112f0aa08dd29 (patch)
tree9f9581570a438116b6b62ed567284f46d8defae5
parent8cd3c6dccf36975fa25c8bcae5e7d74f1fde5a28 (diff)
downloadrsync-5b83829669d9c7e276aeaf8027e112f0aa08dd29.tar.gz
rsync-5b83829669d9c7e276aeaf8027e112f0aa08dd29.tar.bz2
rsync-5b83829669d9c7e276aeaf8027e112f0aa08dd29.zip
A simple change to change_pathname() to ensure that the error output
mentions the right path when dir == NULL.
-rw-r--r--flist.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/flist.c b/flist.c
index 4e302aa6..b0b05dc9 100644
--- a/flist.c
+++ b/flist.c
@@ -366,19 +366,23 @@ int change_pathname(struct file_struct *file, const char *dir, int dirlen)
change_dir(orig_dir, CD_SKIP_CHDIR);
}
- if (!change_dir(dir ? dir : orig_dir, CD_NORMAL)) {
+ pathname = dir;
+ pathname_len = dirlen;
+
+ if (!dir)
+ dir = orig_dir;
+
+ if (!change_dir(dir, CD_NORMAL)) {
chdir_error:
io_error |= IOERR_GENERAL;
rsyserr(FERROR, errno, "change_dir %s failed", full_fname(dir));
- change_dir(orig_dir, CD_NORMAL);
+ if (dir != orig_dir)
+ change_dir(orig_dir, CD_NORMAL);
pathname = NULL;
pathname_len = 0;
return 0;
}
- pathname = dir;
- pathname_len = dirlen;
-
return 1;
}