[ovs-dev] [PATCH 1/2] socket_util.py: Make set_dscp() python 2.4.3 compatible.

Gurucharan Shetty shettyg at nicira.com
Fri Jun 20 19:22:14 UTC 2014


There is no 'errno' field in socket.error. Instead use the
get_exception_errno() function to get the error number.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 python/ovs/socket_util.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py
index 8d34b71..1af6474 100644
--- a/python/ovs/socket_util.py
+++ b/python/ovs/socket_util.py
@@ -302,11 +302,11 @@ def set_dscp(sock, dscp):
     try:
         sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, val)
     except socket.error, e:
-        if e.errno != errno.ENOPROTOOPT:
+        if get_exception_errno(e) != errno.ENOPROTOOPT:
             raise
     success = True
     try:
         sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_TCLASS, val)
     except socket.error, e:
-        if e.errno != errno.ENOPROTOOPT or not success:
+        if get_exception_errno(e) != errno.ENOPROTOOPT or not success:
             raise
-- 
1.7.9.5




More information about the dev mailing list