From a7725e6df9d1ddd69fd4de82d5d703fa073424fa Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 20 Jan 2004 04:53:59 +0000 Subject: [PATCH] Use new pathjoin() function. --- exclude.c | 10 ++++------ rsync.c | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/exclude.c b/exclude.c index 20542a52..702a52ec 100644 --- a/exclude.c +++ b/exclude.c @@ -132,8 +132,7 @@ static int check_one_exclude(char *name, struct exclude_struct *ex, static char full_name[MAXPATHLEN]; extern char curr_dir[]; int plus = curr_dir[1] == '\0'? 1 : 0; - snprintf(full_name, sizeof full_name, - "%s/%s", curr_dir+plus, name); + pathjoin(full_name, sizeof full_name, curr_dir+plus, name); name = full_name; } @@ -443,10 +442,9 @@ void add_cvs_excludes(void) for (i=0; cvs_ignore_list[i]; i++) add_exclude(&exclude_list, cvs_ignore_list[i], ADD_EXCLUDE); - if ((p=getenv("HOME")) && strlen(p) < (MAXPATHLEN-12)) { - snprintf(fname,sizeof(fname), "%s/.cvsignore",p); - add_exclude_file(&exclude_list,fname,MISSING_OK,ADD_EXCLUDE); - } + if ((p = getenv("HOME")) + && pathjoin(fname, sizeof fname, p, ".cvsignore") < sizeof fname) + add_exclude_file(&exclude_list, fname, MISSING_OK, ADD_EXCLUDE); add_exclude_line(&exclude_list, getenv("CVSIGNORE"), ADD_EXCLUDE); } diff --git a/rsync.c b/rsync.c index 670f48b3..3c1115f7 100644 --- a/rsync.c +++ b/rsync.c @@ -93,7 +93,7 @@ int delete_file(char *fname) if (strcmp(dname,".") == 0 || strcmp(dname,"..") == 0) continue; - snprintf(buf, sizeof(buf), "%s/%s", fname, dname); + pathjoin(buf, sizeof buf, fname, dname); if (verbose > 0) rprintf(FINFO,"deleting %s\n", buf); if (delete_file(buf) != 0) { -- 2.34.1