From 30dd54286bf994015d578fc3c111002c12e6f21a Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Thu, 16 Nov 2006 19:34:26 +0000 Subject: 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. --- qacp.c | 10 +++++----- qarsh_packet.c | 8 ++++---- qarshd.c | 12 +++++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/qacp.c b/qacp.c index ed5a973..4e809cd 100644 --- a/qacp.c +++ b/qacp.c @@ -226,9 +226,8 @@ qacp_recvonefile(const char *host, const char *srcfile, const char *destfile) int insd; int outfd; char buf[BUFSIZ]; - ssize_t nread; - ssize_t nwrote; - ssize_t nleft; + ssize_t nread, nwrote; + off_t nleft; struct qp_rstat_pkt *rstatp; int rstaterrno; @@ -284,8 +283,9 @@ qacp_recvonefile(const char *host, const char *srcfile, const char *destfile) if (nleft != 0) { unlink(destfile); fprintf(stderr, "Short file transfer of %s, " - "%lld bytes lost, wanted %lld\n", srcfile, nleft, - rstatp->qp_st_size); + "%lld bytes lost, wanted %lld\n", srcfile, + (long long int)nleft, + (long long int)rstatp->qp_st_size); } close(sd); diff --git a/qarsh_packet.c b/qarsh_packet.c index f3f6ebb..6ba6311 100644 --- a/qarsh_packet.c +++ b/qarsh_packet.c @@ -496,7 +496,7 @@ void string_qp_recvfile(xmlNodePtr node, struct qa_packet *qp) snprintf(tmpstr, 32, "%d", qp->qp_recvfile.qp_if_port); xmlAddChild(node, make_param("if_port", tmpstr)); - snprintf(tmpstr, 32, "%lld", qp->qp_recvfile.qp_count); + snprintf(tmpstr, 32, "%lld", (long long int)qp->qp_recvfile.qp_count); xmlAddChild(node, make_param("count", tmpstr)); snprintf(tmpstr, 32, "%d", qp->qp_recvfile.qp_mode); @@ -523,7 +523,7 @@ void string_qp_rstat(xmlNodePtr node, struct qa_packet *qp) xmlAddChild(node, make_param("st_uid", tmpstr)); snprintf(tmpstr, 32, "%d", qp->qp_rstat.qp_st_gid); xmlAddChild(node, make_param("st_gid", tmpstr)); - snprintf(tmpstr, 32, "%lld", qp->qp_rstat.qp_st_size); + snprintf(tmpstr, 32, "%lld", (long long int)qp->qp_rstat.qp_st_size); xmlAddChild(node, make_param("st_size", tmpstr)); } @@ -831,7 +831,7 @@ dump_qp_recvfile(struct qa_packet *qp) { printf("\tpath: %s\n", qp->qp_recvfile.qp_path); printf("\tif_port: %d\n", qp->qp_recvfile.qp_if_port); - printf("\tcount: %lld\n", qp->qp_recvfile.qp_count); + printf("\tcount: %lld\n", (long long int)qp->qp_recvfile.qp_count); printf("\tmode: %o\n", qp->qp_recvfile.qp_mode); } @@ -849,7 +849,7 @@ dump_qp_rstat(struct qa_packet *qp) printf("\tst_mode: %o\n", qp->qp_rstat.qp_st_mode); printf("\tst_uid: %d\n", qp->qp_rstat.qp_st_uid); printf("\tst_gid: %d\n", qp->qp_rstat.qp_st_gid); - printf("\tst_size: %lld\n", qp->qp_rstat.qp_st_size); + printf("\tst_size: %lld\n", (long long int)qp->qp_rstat.qp_st_size); } void 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"); -- cgit