summaryrefslogtreecommitdiffstats
path: root/qarshd.c
diff options
context:
space:
mode:
authorNate Straz <nstraz@redhat.com>2006-11-16 19:34:26 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:46 -0400
commit30dd54286bf994015d578fc3c111002c12e6f21a (patch)
treee1d87b7838b203dc4b85d6b27febf5520bf9313d /qarshd.c
parentaaf5cb39094bf87ac895210c4cf7f27d4483a3b9 (diff)
downloadqarsh-30dd54286bf994015d578fc3c111002c12e6f21a.tar.gz
qarsh-30dd54286bf994015d578fc3c111002c12e6f21a.tar.xz
qarsh-30dd54286bf994015d578fc3c111002c12e6f21a.zip
Cast off_t variables to long long int when printing so we don't get the
ugly warnings. We should always be compiling with 64-bit off_t's so this should not be a problem. Change nread and nwrote back to ssize_t's since that is what read and write return. nleft remains an off_t because we initialize to stat.st_size.
Diffstat (limited to 'qarshd.c')
-rw-r--r--qarshd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/qarshd.c b/qarshd.c
index a961086..8d79e79 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -118,8 +118,7 @@ recvfile(const char *path, int if_port, off_t count, mode_t mode)
int sd;
int ofd;
char buf[BUFSIZ];
- off_t nread;
- off_t nwrote;
+ ssize_t nread, nwrote;
off_t nleft;
/* Read count bytes from ifd (sd after we connect),
@@ -156,7 +155,9 @@ recvfile(const char *path, int if_port, off_t count, mode_t mode)
if (nleft != 0) {
unlink(path);
syslog(LOG_WARNING, "Short file transfer in recvfile(), "
- "%lld bytes lost, wanted %lld\n", nleft, count);
+ "%lld bytes lost, wanted %lld\n",
+ (long long int)nleft,
+ (long long int)count);
}
close(sd);
@@ -302,7 +303,7 @@ handle_packets(int infd)
"ifd = %d, count = %lld, mode = %o\n",
qp->qp_recvfile.qp_path,
qp->qp_recvfile.qp_if_port,
- qp->qp_recvfile.qp_count,
+ (long long int)qp->qp_recvfile.qp_count,
qp->qp_recvfile.qp_mode);
nbytes = recvfile(qp->qp_recvfile.qp_path,
qp->qp_recvfile.qp_if_port,
@@ -313,7 +314,8 @@ handle_packets(int infd)
} else if (nbytes < qp->qp_recvfile.qp_count) {
char tmpstr[512];
sprintf(tmpstr, "Excpected %lld, wrote %lld\n",
- qp->qp_recvfile.qp_count, nbytes);
+ (long long int)qp->qp_recvfile.qp_count,
+ (long long int)nbytes);
rp = make_qp_returncode(-1, 0, tmpstr);
} else {
rp = make_qp_returncode(0, 0, "Transfer Complete");