socket-util: error number to string for sockets.
[sliver-openvswitch.git] / lib / util.c
index 87cc112..fc990ef 100644 (file)
@@ -323,6 +323,10 @@ ovs_retval_to_string(int retval)
             : ovs_strerror(retval));
 }
 
+/* This function returns the string describing the error number in 'error'
+ * for POSIX platforms.  For Windows, this function can be used for C library
+ * calls.  For socket calls that are also used in Windows, use sock_strerror()
+ * instead.  For WINAPI calls, look at ovs_lasterror_to_string(). */
 const char *
 ovs_strerror(int error)
 {
@@ -376,6 +380,10 @@ set_program_name__(const char *argv0, const char *version, const char *date,
 #ifdef _WIN32
     char *basename;
     size_t max_len = strlen(argv0) + 1;
+
+    if (program_name) {
+        return;
+    }
     basename = xmalloc(max_len);
     _splitpath_s(argv0, NULL, 0, NULL, 0, basename, max_len, NULL, 0);
     assert_single_threaded();