fix for 64 bit time_t and dev_t

This commit is contained in:
christos 2008-12-29 00:33:34 +00:00
parent ab903bdde4
commit 0d7dc435fd
2 changed files with 16 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.27 2008/09/13 02:41:52 lukem Exp $ */
/* $NetBSD: cmds.c,v 1.28 2008/12/29 00:33:34 christos Exp $ */
/*
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: cmds.c,v 1.27 2008/09/13 02:41:52 lukem Exp $");
__RCSID("$NetBSD: cmds.c,v 1.28 2008/12/29 00:33:34 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -760,9 +760,10 @@ fact_type(const char *fact, FILE *fd, factelem *fe)
break;
case S_IFBLK:
case S_IFCHR:
cprintf(fd, "OS.unix=%s-%d/%d",
cprintf(fd, "OS.unix=%s-%llu/%llu",
S_ISBLK(fe->stat->st_mode) ? "blk" : "chr",
major(fe->stat->st_rdev), minor(fe->stat->st_rdev));
(unsigned long long)major(fe->stat->st_rdev),
(unsigned long long)minor(fe->stat->st_rdev));
break;
default:
cprintf(fd, "OS.unix=UNKNOWN(0%o)", fe->stat->st_mode & S_IFMT);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftpd.c,v 1.189 2008/10/28 08:05:26 lukem Exp $ */
/* $NetBSD: ftpd.c,v 1.190 2008/12/29 00:33:34 christos Exp $ */
/*
* Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: ftpd.c,v 1.189 2008/10/28 08:05:26 lukem Exp $");
__RCSID("$NetBSD: ftpd.c,v 1.190 2008/12/29 00:33:34 christos Exp $");
#endif
#endif /* not lint */
@ -3576,8 +3576,9 @@ logxfer(const char *command, off_t bytes, const char *file1, const char *file2,
" %s", r2);
if (elapsed != NULL)
len += snprintf(buf + len, sizeof(buf) - len,
" in %ld.%.03d seconds", elapsed->tv_sec,
(int)(elapsed->tv_usec / 1000));
" in %lld.%.03ld seconds",
(long long)elapsed->tv_sec,
(long)(elapsed->tv_usec / 1000));
if (error != NULL)
len += snprintf(buf + len, sizeof(buf) - len,
": %s", error);
@ -3599,7 +3600,7 @@ logxfer(const char *command, off_t bytes, const char *file1, const char *file2,
time(&now);
len = snprintf(buf, sizeof(buf),
"%.24s %ld %s " LLF " %s %c %s %c %c %s FTP 0 * %c\n",
"%.24s %lld %s " LLF " %s %c %s %c %c %s FTP 0 * %c\n",
/*
* XXX: wu-ftpd puts ' (send)' or ' (recv)' in the syslog message, and removes
@ -3607,7 +3608,8 @@ logxfer(const char *command, off_t bytes, const char *file1, const char *file2,
* given that syslog messages don't contain the full date.
*/
ctime(&now),
elapsed == NULL ? 0 : elapsed->tv_sec + (elapsed->tv_usec > 0),
(long long)
(elapsed == NULL ? 0 : elapsed->tv_sec + (elapsed->tv_usec > 0)),
remotehost,
(LLT) bytes,
r1,
@ -3647,9 +3649,9 @@ logrusage(const struct rusage *rusage_before,
timersub(&rusage_after->ru_utime, &rusage_before->ru_utime, &usrtime);
timersub(&rusage_after->ru_stime, &rusage_before->ru_stime, &systime);
syslog(LOG_INFO, "%ld.%.03du %ld.%.03ds %ld+%ldio %ldpf+%ldw",
usrtime.tv_sec, (int)(usrtime.tv_usec / 1000),
systime.tv_sec, (int)(systime.tv_usec / 1000),
syslog(LOG_INFO, "%lld.%.03ldu %lld.%.03lds %ld+%ldio %ldpf+%ldw",
(long long)usrtime.tv_sec, (long)(usrtime.tv_usec / 1000),
(long long)systime.tv_sec, (long)(systime.tv_usec / 1000),
rusage_after->ru_inblock - rusage_before->ru_inblock,
rusage_after->ru_oublock - rusage_before->ru_oublock,
rusage_after->ru_majflt - rusage_before->ru_majflt,