[PATCH spice-server 15/33] test-leaks: Use socket compatibility layer

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

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/tests/test-leaks.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c
index 64130c22..98f9cb67 100644
--- a/server/tests/test-leaks.c
+++ b/server/tests/test-leaks.c
@@ -35,6 +35,7 @@
 #include "test-glib-compat.h"
 #include "basic-event-loop.h"
 #include "test-display-base.h"
+#include "sys-socket.h"
 
 #define PKI_DIR SPICE_TOP_SRCDIR "/server/tests/pki/"
 
@@ -43,7 +44,7 @@ static void server_leaks(void)
     int result;
     SpiceCoreInterface *core;
     SpiceServer *server = spice_server_new();
-    int sv[2];
+    socket_t sv[2];
 
     g_assert_nonnull(server);
 
@@ -69,12 +70,12 @@ static void server_leaks(void)
     /* spice_server_add_ssl_client should not leak when it's given a disconnected socket */
     g_test_expect_message(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
                           "*SSL_accept failed*");
-    g_assert_cmpint(socketpair(AF_LOCAL, SOCK_STREAM, 0, sv), ==, 0);
-    close(sv[1]);
-    result = spice_server_add_ssl_client(server, sv[0], 1);
+    g_assert_cmpint(socket_newpair(SOCK_STREAM, 0, sv), ==, 0);
+    socket_close(sv[1]);
+    result = spice_server_add_ssl_client(server, socket_get_raw(sv[0]), 1);
     g_assert_cmpint(result, ==, -1);
     /* if the function fails, it should not close the socket */
-    g_assert_cmpint(close(sv[0]), ==, 0);
+    g_assert_cmpint(socket_close(sv[0]), ==, 0);
 
     spice_server_destroy(server);
     basic_event_loop_destroy();
-- 
2.17.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]