X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Fpdu.c;h=135efcbf9983322d9b082071a90e31b282643ee0;hb=a3d6cf111ed6c756b4483eb02486c046a3d0195b;hp=601f11023778a28bb71d83b5d1844fce49c19f22;hpb=2e4db0d14597fdb0013fb16f24b3f872d1217397;p=deb_libnfs.git
diff --git a/lib/pdu.c b/lib/pdu.c
index 601f110..135efcb 100644
--- a/lib/pdu.c
+++ b/lib/pdu.c
@@ -15,8 +15,14 @@
along with this program; if not, see .
*/
-#include
+#if defined(WIN32)
+#include
+#define MSG_DONTWAIT 0
+#else
#include
+#endif
+
+#include
#include
#include
#include
@@ -41,7 +47,7 @@ struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int versi
rpc_set_error(rpc, "Out of memory: Failed to allocate pdu structure");
return NULL;
}
- bzero(pdu, sizeof(struct rpc_pdu));
+ bzero((char *)pdu, sizeof(struct rpc_pdu));
pdu->xid = rpc->xid++;
pdu->cb = cb;
pdu->private_data = private_data;
@@ -53,7 +59,7 @@ struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int versi
xdr_setpos(&pdu->xdr, 4); /* skip past the record marker */
}
- bzero(&msg, sizeof(struct rpc_msg));
+ bzero((char *)&msg, sizeof(struct rpc_msg));
msg.rm_xid = pdu->xid;
msg.rm_direction = CALL;
msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
@@ -146,16 +152,19 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR *
{
struct rpc_msg msg;
- bzero(&msg, sizeof(struct rpc_msg));
+ bzero((char *)&msg, sizeof(struct rpc_msg));
msg.acpted_rply.ar_verf = _null_auth;
if (pdu->xdr_decode_bufsize > 0) {
+ if (pdu->xdr_decode_buf != NULL) {
+ free(pdu->xdr_decode_buf);
+ }
pdu->xdr_decode_buf = malloc(pdu->xdr_decode_bufsize);
if (pdu->xdr_decode_buf == NULL) {
rpc_set_error(rpc, "xdr_replymsg failed in portmap_getport_reply");
pdu->cb(rpc, RPC_STATUS_ERROR, "Failed to allocate buffer for decoding of XDR reply", pdu->private_data);
return 0;
}
- bzero(pdu->xdr_decode_buf, pdu->xdr_decode_bufsize);
+ bzero((char *)pdu->xdr_decode_buf, pdu->xdr_decode_bufsize);
}
msg.acpted_rply.ar_results.where = pdu->xdr_decode_buf;
msg.acpted_rply.ar_results.proc = pdu->xdr_decode_fn;
@@ -207,7 +216,7 @@ int rpc_process_pdu(struct rpc_context *rpc, char *buf, int size)
int pos, recordmarker;
unsigned int xid;
- bzero(&xdr, sizeof(XDR));
+ bzero((char *)&xdr, sizeof(XDR));
xdrmem_create(&xdr, buf, size, XDR_DECODE);
if (rpc->is_udp == 0) {