From: Wayne Davison Date: Fri, 18 Feb 2005 20:17:17 +0000 (+0000) Subject: The '%n' escape needs to append a trailing slash onto a directory name. X-Git-Tag: v2.6.4pre1~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e66d70e34cd84c49e36c78920e33da5db72f82a8;p=thirdparty%2Frsync.git The '%n' escape needs to append a trailing slash onto a directory name. --- diff --git a/log.c b/log.c index d191ea10..42ad4709 100644 --- a/log.c +++ b/log.c @@ -343,7 +343,7 @@ static void log_formatted(enum logcode code, struct stats *initial_stats, int iflags) { char buf[MAXPATHLEN+1024]; - char buf2[1024]; + char buf2[MAXPATHLEN]; char *p, *n; size_t len, total; int64 b; @@ -380,6 +380,11 @@ static void log_formatted(enum logcode code, break; case 'n': n = (char*)safe_fname(f_name(file)); + if (S_ISDIR(file->mode)) { + /* The buffer from safe_fname() has more + * room than MAXPATHLEN, so this is safe. */ + strcat(n, "/"); + } break; case 'L': if (S_ISLNK(file->mode)) {