[glib: 3/12] gio/tests: close leaked fd




commit 18d98e30f960273c440eac752dfb2983d182b210
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Fri Apr 8 00:11:23 2022 +0400

    gio/tests: close leaked fd
    
    Also fixes some of the test on win32, since it won't delete files that
    are opened.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 gio/tests/gdbus-peer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index 2f2caf77ad..7ca8bb7157 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -1682,6 +1682,7 @@ test_nonce_tcp (void)
   gchar *nonce_file;
   gboolean res;
   const gchar *address;
+  int fd;
 
   test_guid = g_dbus_generate_guid ();
   loop = g_main_loop_new (NULL, FALSE);
@@ -1780,7 +1781,9 @@ test_nonce_tcp (void)
   g_assert (c == NULL);
 
   /* Recreate the nonce-file so we can ensure the server deletes it when stopped. */
-  g_assert_cmpint (g_creat (nonce_file, 0600), !=, -1);
+  fd = g_creat (nonce_file, 0600);
+  g_assert_cmpint (fd, !=, -1);
+  g_close (fd, NULL);
 
   g_dbus_server_stop (server);
   g_object_unref (server);


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