aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2004-11-13 12:39:30 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2004-11-13 12:39:30 +0000
commit13ba32ad3fb29208165969e67aec888411e1fcff (patch)
tree767a1d39425154c9509c935f5091dbda64926ffe /libexec
parent33827169c5e33dc2cfc67fd99ae204fc65f57517 (diff)
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index e8e25b4039ac..c23d1ec303b6 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1701,8 +1701,8 @@ retrieve(char *cmd, char *name)
time(&start);
send_data(fin, dout, st.st_blksize, st.st_size,
restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode));
- if (cmd == 0 && guest && stats)
- logxfer(name, st.st_size, start);
+ if (cmd == 0 && guest && stats && byte_count > 0)
+ logxfer(name, byte_count, start);
(void) fclose(dout);
data = -1;
pdata = -1;
@@ -3157,15 +3157,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!%qd!%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, (long long)size,
+ path, (intmax_t)size,
(long)(now - start + (now == start)));
write(statfd, buf, strlen(buf));
}