diff options
-rw-r--r-- | libexec/ftpd/ftpd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index aeeaada..712f713 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -3169,15 +3169,19 @@ setproctitle(const char *fmt, ...) static void logxfer(char *name, off_t size, time_t start) { - char buf[1024]; + char buf[MAXPATHLEN + 1024]; char path[MAXPATHLEN + 1]; time_t now; - if (statfd >= 0 && getwd(path) != NULL) { + if (statfd >= 0) { time(&now); - snprintf(buf, sizeof(buf), "%.20s!%s!%s!%s/%s!%jd!%ld\n", + if (realpath(name, path) == NULL) { + syslog(LOG_NOTICE, "realpath failed on %s: %m", path); + return; + } + snprintf(buf, sizeof(buf), "%.20s!%s!%s!%s!%jd!%ld\n", ctime(&now)+4, ident, remotehost, - path, name, (intmax_t)size, + path, (intmax_t)size, (long)(now - start + (now == start))); write(statfd, buf, strlen(buf)); } |