summaryrefslogtreecommitdiff
path: root/flist.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-01-20 17:46:30 +0000
committerWayne Davison <wayned@samba.org>2004-01-20 17:46:30 +0000
commit808c57c3439ed65062ff79193a67b1e281060ab1 (patch)
treef52939751a9103c6e1d1e61104d6a9aa47db15a6 /flist.c
parent4af8fe4e789162a3aea497f2a8218bc49aecdb60 (diff)
downloadrsync-808c57c3439ed65062ff79193a67b1e281060ab1.tar.gz
rsync-808c57c3439ed65062ff79193a67b1e281060ab1.tar.bz2
rsync-808c57c3439ed65062ff79193a67b1e281060ab1.zip
- Use the new push_dir() and pop_dir() calling syntax.
- The "olddir" handling changed to accommodate the above, and to avoid using malloc()/free().
Diffstat (limited to 'flist.c')
-rw-r--r--flist.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/flist.c b/flist.c
index 4c7331f5..bc08898a 100644
--- a/flist.c
+++ b/flist.c
@@ -43,6 +43,7 @@ extern int ignore_errors;
extern int cvs_exclude;
extern int recurse;
+extern char curr_dir[MAXPATHLEN];
extern char *files_from;
extern int filesfrom_fd;
@@ -987,7 +988,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
{
int l;
STRUCT_STAT st;
- char *p, *dir, *olddir;
+ char *p, *dir, olddir[sizeof curr_dir];
char lastpath[MAXPATHLEN] = "";
struct file_list *flist;
int64 start_write;
@@ -1003,7 +1004,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
if (f != -1) {
io_start_buffering_out(f);
if (filesfrom_fd >= 0) {
- if (argv[0] && !push_dir(argv[0], 0)) {
+ if (argv[0] && !push_dir(argv[0])) {
rprintf(FERROR, "push_dir %s failed: %s\n",
full_fname(argv[0]), strerror(errno));
exit_cleanup(RERR_FILESELECT);
@@ -1054,7 +1055,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
}
dir = NULL;
- olddir = NULL;
+ olddir[0] = '\0';
if (!relative_paths) {
p = strrchr(fname, '/');
@@ -1105,9 +1106,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
fname = ".";
if (dir && *dir) {
- olddir = push_dir(dir, 1);
+ strcpy(olddir, curr_dir); /* can't overflow */
- if (!olddir) {
+ if (!push_dir(dir)) {
io_error |= IOERR_GENERAL;
rprintf(FERROR, "push_dir %s failed: %s\n",
full_fname(dir), strerror(errno));
@@ -1122,9 +1123,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
send_file_name(f, flist, fname, recurse, FLAG_DELETE);
- if (olddir != NULL) {
+ if (olddir[0]) {
flist_dir = NULL;
- if (pop_dir(olddir) != 0) {
+ if (!pop_dir(olddir)) {
rprintf(FERROR, "pop_dir %s failed: %s\n",
full_fname(dir), strerror(errno));
exit_cleanup(RERR_FILESELECT);