From: Wayne Davison Date: Tue, 20 Jan 2004 17:46:30 +0000 (+0000) Subject: - Use the new push_dir() and pop_dir() calling syntax. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/808c57c3439ed65062ff79193a67b1e281060ab1 - Use the new push_dir() and pop_dir() calling syntax. - The "olddir" handling changed to accommodate the above, and to avoid using malloc()/free(). --- 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);