summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-10-30 16:19:33 +0200
committerStefan Metzmacher <metze@samba.org>2011-03-03 22:57:26 +0100
commit7bdc3db9ea5380eeee8d975b3579dcf673a0eafa (patch)
tree49af3a5efc3a0de946ebab8701169faadbea996d
parent0ad8d459c6f47a0d70c8af2b19e6585a38f34cb4 (diff)
downloadsamba-7bdc3db9ea5380eeee8d975b3579dcf673a0eafa.tar.gz
samba-7bdc3db9ea5380eeee8d975b3579dcf673a0eafa.tar.bz2
samba-7bdc3db9ea5380eeee8d975b3579dcf673a0eafa.zip
socket_wrapper: move swrap_ioctl() above the send*/recv* functions
metze
-rw-r--r--lib/socket_wrapper/socket_wrapper.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index 1fe3832a17..d1508adbca 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -1870,6 +1870,32 @@ _PUBLIC_ int swrap_setsockopt(int s, int level, int optname, const void *o
}
}
+_PUBLIC_ int swrap_ioctl(int s, int r, void *p)
+{
+ int ret;
+ struct socket_info *si = find_socket_info(s);
+ int value;
+
+ if (!si) {
+ return real_ioctl(s, r, p);
+ }
+
+ ret = real_ioctl(s, r, p);
+
+ switch (r) {
+ case FIONREAD:
+ value = *((int *)p);
+ if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
+ swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
+ } else if (value == 0) { /* END OF FILE */
+ swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
+ }
+ break;
+ }
+
+ return ret;
+}
+
_PUBLIC_ ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
{
struct sockaddr_un un_addr;
@@ -2026,32 +2052,6 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
return ret;
}
-_PUBLIC_ int swrap_ioctl(int s, int r, void *p)
-{
- int ret;
- struct socket_info *si = find_socket_info(s);
- int value;
-
- if (!si) {
- return real_ioctl(s, r, p);
- }
-
- ret = real_ioctl(s, r, p);
-
- switch (r) {
- case FIONREAD:
- value = *((int *)p);
- if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
- swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
- } else if (value == 0) { /* END OF FILE */
- swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
- }
- break;
- }
-
- return ret;
-}
-
_PUBLIC_ ssize_t swrap_recv(int s, void *buf, size_t len, int flags)
{
int ret;