[wing/wip/createpipe] namedpipeclient: handle case where we can't create the file



commit 3025f734fda87e86a917f417a8215c898d992aab
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Mon Sep 19 12:36:44 2016 +0200

    namedpipeclient: handle case where we can't create the file
    
    If the file cannot be created we should just error out with
    the proper GError set.

 wing/wingnamedpipeclient.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/wing/wingnamedpipeclient.c b/wing/wingnamedpipeclient.c
index a749747..1f17574 100644
--- a/wing/wingnamedpipeclient.c
+++ b/wing/wingnamedpipeclient.c
@@ -192,6 +192,20 @@ wing_named_pipe_client_connect (WingNamedPipeClient  *client,
                             FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
                             NULL);
 
+      if (handle == INVALID_HANDLE_VALUE)
+        {
+          int errsv;
+          gchar *err;
+
+          errsv = GetLastError ();
+          err = g_win32_error_message (errsv);
+          g_set_error_literal (error, G_IO_ERROR,
+                               g_io_error_from_win32_error (errsv),
+                               err);
+          g_free (err);
+          goto end;
+        }
+
       if (g_cancellable_set_error_if_cancelled (cancellable, error))
           goto end;
 


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