Merge branch 'win32' into win32-3
[deb_libnfs.git] / lib / pdu.c
index 601f11023778a28bb71d83b5d1844fce49c19f22..6cb85ae8028e436e1eed5dda5f3ff89586dfdf79 100644 (file)
--- a/lib/pdu.c
+++ b/lib/pdu.c
    along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <stdio.h>
+#if defined(WIN32)
+#include <winsock2.h>
+#define MSG_DONTWAIT 0
+#else
 #include <strings.h>
+#endif
+
+#include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <rpc/rpc.h>
@@ -149,6 +155,9 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR *
        bzero(&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");