[ovs-dev] [PATCH] netdev-linux: Fix netdev_linux_send() return value in corner case.

Ben Pfaff blp at nicira.com
Tue Feb 26 20:35:51 UTC 2013


A negative 'sock' means there was an error but netdev_linux_send() returns
a positive errno value on error.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/netdev-linux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 4ea7a36..c0e0c40 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -916,7 +916,7 @@ netdev_linux_send(struct netdev *netdev_, const void *data, size_t size)
 
             sock = af_packet_sock();
             if (sock < 0) {
-                return sock;
+                return -sock;
             }
 
             error = get_ifindex(netdev_, &ifindex);
-- 
1.7.2.5




More information about the dev mailing list