From ec028b555bbca84e1f949c6632099f8407c0d695 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 30 Oct 2010 16:28:23 +0200 Subject: socket_wrapper: readv() should only work on connected sockets metze --- lib/socket_wrapper/socket_wrapper.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c index d1508adbca..26988f0b1f 100644 --- a/lib/socket_wrapper/socket_wrapper.c +++ b/lib/socket_wrapper/socket_wrapper.c @@ -2244,6 +2244,11 @@ int swrap_readv(int s, const struct iovec *vector, size_t count) return real_readv(s, vector, count); } + if (!si->connected) { + errno = ENOTCONN; + return -1; + } + if (si->type == SOCK_STREAM && count > 0) { /* cut down to 1500 byte packets for stream sockets, * which makes it easier to format PCAP capture files -- cgit