From 3ec271bada5f87eccf49a01a1121a0066c77a91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 17 Jan 2020 11:17:49 +0000 Subject: [PATCH] src: conditionalize use of S_ISSOCK macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The S_ISSOCK macro is not available on Windows platforms. Reviewed-by: Pavel Hrdina Signed-off-by: Daniel P. Berrangé --- src/libvirt-domain.c | 2 ++ src/security/security_manager.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 4074397b30..ceda85c243 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -10584,12 +10584,14 @@ virDomainOpenGraphics(virDomainPtr dom, goto error; } +#ifndef WIN32 if (!S_ISSOCK(sb.st_mode)) { virReportInvalidArg(fd, _("fd %d must be a socket"), fd); goto error; } +#endif /* !WIN32 */ virCheckReadOnlyGoto(dom->conn->flags, error); diff --git a/src/security/security_manager.c b/src/security/security_manager.c index f229d94570..fe9def7fb9 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -1340,11 +1340,13 @@ virSecurityManagerMetadataLock(virSecurityManagerPtr mgr G_GNUC_UNUSED, } if ((fd = open(p, O_RDWR)) < 0) { +#ifndef WIN32 if (S_ISSOCK(sb.st_mode)) { /* Sockets can be opened only if there exists the * other side that listens. */ continue; } +#endif /* !WIN32 */ virReportSystemError(errno, _("unable to open %s"), -- GitLab