From eb3641f34797a3c6408c79fa9a542c424fe78ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 8 Jan 2021 17:32:03 +0000 Subject: [PATCH] src: simplify some conditionals related to features lacking on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids the need to probe for them prior to build. Signed-off-by: Daniel P. Berrangé --- configure.ac | 5 ----- src/virt-viewer-app.c | 18 +++++------------- src/virt-viewer.c | 6 +++--- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index ab5861b..469559f 100644 --- a/configure.ac +++ b/configure.ac @@ -204,11 +204,6 @@ AS_IF([test "x$with_ovirt" = "xyes"], ) AM_CONDITIONAL([HAVE_OVIRT], [test "x$with_ovirt" = "xyes"]) -dnl Decide if this platform can support the SSH tunnel feature. -AC_CHECK_HEADERS([sys/socket.h sys/un.h windows.h]) -AC_CHECK_FUNCS([fork socketpair]) - - if test "x$with_gtk_vnc" != "xyes" && test "x$with_spice_gtk" != "xyes"; then AC_MSG_ERROR([At least one of spice or vnc must be used]) fi diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index ca94816..cdf55e3 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -39,17 +39,9 @@ #ifndef G_OS_WIN32 #include -#endif - -#ifdef HAVE_SYS_SOCKET_H #include -#endif - -#ifdef HAVE_SYS_UN_H #include -#endif - -#ifdef HAVE_WINDOWS_H +#else #include #endif @@ -768,7 +760,7 @@ virt_viewer_app_about_delete(GtkWidget *dialog, gtk_widget_destroy(dialog); } -#if defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) +#ifndef G_OS_WIN32 static int virt_viewer_app_open_tunnel(const char **cmd) @@ -885,7 +877,7 @@ virt_viewer_app_open_unix_sock(const char *unixsock, GError **error) return fd; } -#endif /* defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) */ +#endif /* ! G_OS_WIN32 */ void virt_viewer_app_trace(VirtViewerApp *self, @@ -1377,7 +1369,7 @@ virt_viewer_app_open_connection(VirtViewerApp *self, int *fd) } -#if defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) +#ifndef G_OS_WIN32 static void virt_viewer_app_channel_open(VirtViewerSession *session, VirtViewerSessionChannel *channel, @@ -1448,7 +1440,7 @@ virt_viewer_app_default_activate(VirtViewerApp *self, GError **error) g_debug("After open connection callback fd=%d", fd); -#if defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) +#ifndef G_OS_WIN32 if (priv->transport && g_ascii_strcasecmp(priv->transport, "ssh") == 0 && !priv->direct && diff --git a/src/virt-viewer.c b/src/virt-viewer.c index aa0a21f..61e3e73 100644 --- a/src/virt-viewer.c +++ b/src/virt-viewer.c @@ -42,7 +42,7 @@ #include #include -#if defined(HAVE_SOCKETPAIR) +#ifndef G_OS_WIN32 #include #endif @@ -681,7 +681,7 @@ virt_viewer_open_connection(VirtViewerApp *self G_GNUC_UNUSED, int *fd) VirtViewer *viewer = VIRT_VIEWER(self); VirtViewerPrivate *priv = viewer->priv; virErrorPtr err; -#if defined(HAVE_SOCKETPAIR) +#ifndef G_OS_WIN32 int pair[2]; #endif *fd = -1; @@ -699,7 +699,7 @@ virt_viewer_open_connection(VirtViewerApp *self G_GNUC_UNUSED, int *fd) return TRUE; } -#if defined(HAVE_SOCKETPAIR) +#ifndef G_OS_WIN32 if (socketpair(PF_UNIX, SOCK_STREAM, 0, pair) < 0) return FALSE;