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>
This commit is contained in:
Marc-André Lureau 2022-04-08 00:11:23 +04:00
parent a638b2bbd1
commit 18d98e30f9

View File

@ -1682,6 +1682,7 @@ test_nonce_tcp (void)
gchar *nonce_file; gchar *nonce_file;
gboolean res; gboolean res;
const gchar *address; const gchar *address;
int fd;
test_guid = g_dbus_generate_guid (); test_guid = g_dbus_generate_guid ();
loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
@ -1780,7 +1781,9 @@ test_nonce_tcp (void)
g_assert (c == NULL); g_assert (c == NULL);
/* Recreate the nonce-file so we can ensure the server deletes it when stopped. */ /* 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_dbus_server_stop (server);
g_object_unref (server); g_object_unref (server);