diff options
| author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-11-03 06:52:40 +0000 |
|---|---|---|
| committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2004-11-03 06:52:40 +0000 |
| commit | 8c1c21f2ef306958dbd1b7cb4093faacab4bcfd6 (patch) | |
| tree | 822990ebb1674c0b6b295886e723b1fdbc4a1cb4 | |
| parent | f79bef60979a43b9f4ac0f03ca4e53eefc65c8e3 (diff) | |
Notes
| -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 aeeaada6b760..712f71318d57 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)); } |
