Commit e66d70e3 authored by Wayne Davison's avatar Wayne Davison

The '%n' escape needs to append a trailing slash onto a directory name.

parent 9361f839
...@@ -343,7 +343,7 @@ static void log_formatted(enum logcode code, ...@@ -343,7 +343,7 @@ static void log_formatted(enum logcode code,
struct stats *initial_stats, int iflags) struct stats *initial_stats, int iflags)
{ {
char buf[MAXPATHLEN+1024]; char buf[MAXPATHLEN+1024];
char buf2[1024]; char buf2[MAXPATHLEN];
char *p, *n; char *p, *n;
size_t len, total; size_t len, total;
int64 b; int64 b;
...@@ -380,6 +380,11 @@ static void log_formatted(enum logcode code, ...@@ -380,6 +380,11 @@ static void log_formatted(enum logcode code,
break; break;
case 'n': case 'n':
n = (char*)safe_fname(f_name(file)); 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; break;
case 'L': case 'L':
if (S_ISLNK(file->mode)) { if (S_ISLNK(file->mode)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment