[ovs-dev] [PATCH] netlink-socket: Convert from error number to string correctly.

Gurucharan Shetty shettyg at nicira.com
Tue Sep 9 19:39:16 UTC 2014


As mentioned in the comment above the function ovs_strerror(), it
should not be used to convert WINAPI error numbers to string.
Use ovs_lasterror_to_string() instead.

CC: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
CC: Eitan Eliahu <eliahue at vmware.com>

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 lib/netlink-socket.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index f91b909..bdc1ade 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -147,16 +147,14 @@ nl_sock_create(int protocol, struct nl_sock **sockp)
                               FILE_FLAG_OVERLAPPED, NULL);
 
     if (sock->handle == INVALID_HANDLE_VALUE) {
-        int last_error = GetLastError();
-        VLOG_ERR("fcntl: %s", ovs_strerror(last_error));
+        VLOG_ERR("fcntl: %s", ovs_lasterror_to_string());
         goto error;
     }
 
     memset(&sock->overlapped, 0, sizeof sock->overlapped);
     sock->overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
     if (sock->overlapped.hEvent == NULL) {
-        int last_error = GetLastError();
-        VLOG_ERR("fcntl: %s", ovs_strerror(last_error));
+        VLOG_ERR("fcntl: %s", ovs_lasterror_to_string());
         goto error;
     }
 
-- 
1.7.9.5




More information about the dev mailing list