diff options
author | Wayne Davison <wayned@samba.org> | 2004-01-20 17:46:30 +0000 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2004-01-20 17:46:30 +0000 |
commit | 808c57c3439ed65062ff79193a67b1e281060ab1 (patch) | |
tree | f52939751a9103c6e1d1e61104d6a9aa47db15a6 /flist.c | |
parent | 4af8fe4e789162a3aea497f2a8218bc49aecdb60 (diff) | |
download | rsync-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.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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); |