summaryrefslogtreecommitdiffstats
path: root/qarshd.c
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2006-11-16 04:17:02 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:46 -0400
commit9fc82fc82e7248a598b8c8bedd86cecb3c10d1e9 (patch)
tree1234bdb063d6ae9feed841546cda5ed710409ec6 /qarshd.c
parent5d90b7ceb5e0bd2fd41ded8ec706b04cacfc647c (diff)
downloadqarsh-9fc82fc82e7248a598b8c8bedd86cecb3c10d1e9.tar.gz
qarsh-9fc82fc82e7248a598b8c8bedd86cecb3c10d1e9.tar.xz
qarsh-9fc82fc82e7248a598b8c8bedd86cecb3c10d1e9.zip
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.
Diffstat (limited to 'qarshd.c')
-rw-r--r--qarshd.c19
1 files changed, 10 insertions, 9 deletions
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 {