Use new pathjoin() function.
authorWayne Davison <wayned@samba.org>
Tue, 20 Jan 2004 04:53:59 +0000 (04:53 +0000)
committerWayne Davison <wayned@samba.org>
Tue, 20 Jan 2004 04:53:59 +0000 (04:53 +0000)
exclude.c
rsync.c

index 20542a5..702a52e 100644 (file)
--- 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 670f48b..3c1115f 100644 (file)
--- 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) {