From 9fc82fc82e7248a598b8c8bedd86cecb3c10d1e9 Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Thu, 16 Nov 2006 04:17:02 +0000 Subject: Use off_t instead of size_t so we can transfer files larger than 2GB. I changed all formats from %zd to %lld, but this adds a lot of warnings because off_t isn't the same as long long int to the compiler. I don't know if there is a way to avoid the warnings on all platforms. --- qarshd.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'qarshd.c') diff --git a/qarshd.c b/qarshd.c index 9f9bba8..a961086 100644 --- a/qarshd.c +++ b/qarshd.c @@ -112,15 +112,15 @@ run_cmd(const char *cmd, int p_in, int p_out, int p_err) return pid; } -ssize_t -recvfile(const char *path, int if_port, size_t count, mode_t mode) +off_t +recvfile(const char *path, int if_port, off_t count, mode_t mode) { int sd; int ofd; char buf[BUFSIZ]; - ssize_t nread; - ssize_t nwrote; - ssize_t nleft; + off_t nread; + off_t nwrote; + off_t nleft; /* Read count bytes from ifd (sd after we connect), * write into file @ path @@ -156,7 +156,7 @@ recvfile(const char *path, int if_port, size_t count, mode_t mode) if (nleft != 0) { unlink(path); syslog(LOG_WARNING, "Short file transfer in recvfile(), " - "%zd bytes lost, wanted %zd\n", nleft, count); + "%lld bytes lost, wanted %lld\n", nleft, count); } close(sd); @@ -232,7 +232,7 @@ handle_packets(int infd) pid_t child_pid = 0; int child_status; - ssize_t nbytes; + off_t nbytes; sigemptyset(&sigmask); sigaddset(&sigmask, SIGCHLD); @@ -271,6 +271,7 @@ handle_packets(int infd) syslog(LOG_DEBUG, "That's enough\n"); break; } + dump_qp(qp); switch (qp->qp_type) { case QP_KILL: if (child_pid) { @@ -298,7 +299,7 @@ handle_packets(int infd) break; case QP_RECVFILE: syslog(LOG_INFO, "Got a QP_RECVFILE with path = %s, " - "ifd = %d, count = %zd, mode = %o\n", + "ifd = %d, count = %lld, mode = %o\n", qp->qp_recvfile.qp_path, qp->qp_recvfile.qp_if_port, qp->qp_recvfile.qp_count, @@ -311,7 +312,7 @@ handle_packets(int infd) rp = make_qp_returncode(-1, errno, strerror(errno)); } else if (nbytes < qp->qp_recvfile.qp_count) { char tmpstr[512]; - sprintf(tmpstr, "Excpected %zd, wrote %zd\n", + sprintf(tmpstr, "Excpected %lld, wrote %lld\n", qp->qp_recvfile.qp_count, nbytes); rp = make_qp_returncode(-1, 0, tmpstr); } else { -- cgit