[glib] registrybackend: do not accept 0 as a windows error



commit bc85dee6b3f403f94b742461427903069aa00621
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Jan 26 13:19:56 2016 +0100

    registrybackend: do not accept 0 as a windows error
    
    We might end up removing from the error stack the wrong error
    and this might be missleading

 gio/gregistrysettingsbackend.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c
index 21e9a63..cf83d4a 100644
--- a/gio/gregistrysettingsbackend.c
+++ b/gio/gregistrysettingsbackend.c
@@ -211,8 +211,7 @@ g_message_win32_error (DWORD        result_code,
   gint pos;
   gchar win32_message[1024];
 
-  if (result_code == 0)
-    result_code = GetLastError ();
+  g_return_if_fail (result_code != 0);
 
   va_start (va, format);
   pos = g_vsnprintf (win32_message, 512, format, va);
@@ -1705,7 +1704,7 @@ watch_start (GRegistryBackend *self)
   watch->message_received_event = CreateEvent (NULL, FALSE, FALSE, NULL);
   if (watch->message_sent_event == NULL || watch->message_received_event == NULL)
     {
-      g_message_win32_error (0, "gregistrybackend: Failed to create sync objects.");
+      g_message_win32_error (GetLastError (), "gregistrybackend: Failed to create sync objects.");
       goto fail;
     }
 
@@ -1713,7 +1712,7 @@ watch_start (GRegistryBackend *self)
   watch->thread = CreateThread (NULL, 1024, watch_thread_function, watch, 0, NULL);
   if (watch->thread == NULL)
     {
-      g_message_win32_error (0, "gregistrybackend: Failed to create notify watch thread.");
+      g_message_win32_error (GetLastError (), "gregistrybackend: Failed to create notify watch thread.");
       goto fail;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]