about summary refs log tree commit diff
path: root/src/network/recvmsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/recvmsg.c')
-rw-r--r--src/network/recvmsg.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/recvmsg.c b/src/network/recvmsg.c
index edc5f241..65094fc8 100644
--- a/src/network/recvmsg.c
+++ b/src/network/recvmsg.c
@@ -1,12 +1,24 @@
 #include <sys/socket.h>
+#include <limits.h>
 #include "syscall.h"
 #include "libc.h"
 
 ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
 {
 	ssize_t r;
+#if LONG_MAX > INT_MAX
+	struct msghdr h, *orig = msg;
+	if (msg) {
+		h = *msg;
+		h.__pad1 = h.__pad2 = 0;
+		msg = &h;
+	}
+#endif
 	CANCELPT_BEGIN;
 	r = socketcall(recvmsg, fd, msg, flags, 0, 0, 0);
 	CANCELPT_END;
+#if LONG_MAX > INT_MAX
+	if (orig) *orig = h;
+#endif
 	return r;
 }