]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: remove unused helper for getting UNIX socket path
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 25 Jun 2019 17:36:36 +0000 (18:36 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 12 Jul 2019 15:55:40 +0000 (16:55 +0100)
The new systemd activation APIs mean there is no longer a need to get
the UNIX socket path associated with a plain FD.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/libvirt_private.syms
src/util/virutil.c
src/util/virutil.h

index 11134e2e34d886bc0c42d7480aa211db2a7d8380..7dfa5af3b3173562a228e84d9a0bc08f38e8c485 100644 (file)
@@ -3234,7 +3234,6 @@ virGetHostnameQuiet;
 virGetSelfLastChanged;
 virGetSystemPageSize;
 virGetSystemPageSizeKB;
-virGetUNIXSocketPath;
 virGetUnprivSGIOSysfsPath;
 virGetUserCacheDirectory;
 virGetUserConfigDirectory;
index 4bd719127bf474e43f9238dd098407f677b4723f..019009be8c510149502ec9ea33a1b1f98fe84bb5 100644 (file)
@@ -1785,50 +1785,6 @@ void virUpdateSelfLastChanged(const char *path)
 }
 
 
-#ifdef HAVE_SYS_UN_H
-char *virGetUNIXSocketPath(int fd)
-{
-    union {
-        struct sockaddr sa;
-        struct sockaddr_storage ss;
-        struct sockaddr_un un;
-    } addr = { .ss = { 0 } };
-    socklen_t len = sizeof(addr.ss);
-    char *path;
-
-    if (getsockname(fd, &addr.sa, &len) < 0) {
-        virReportSystemError(errno, _("Unable to get address of FD %d"), fd);
-        return NULL;
-    }
-
-    if (addr.ss.ss_family != AF_UNIX) {
-        virReportSystemError(EINVAL, _("FD %d is not a UNIX socket, has af=%d"),
-                             fd, addr.ss.ss_family);
-        return NULL;
-    }
-
-    if (addr.un.sun_path[0] == '\0')
-        addr.un.sun_path[0] = '@';
-
-    if (VIR_ALLOC_N(path, sizeof(addr.un.sun_path) + 1) < 0)
-        return NULL;
-
-    memcpy(path, addr.un.sun_path, sizeof(addr.un.sun_path));
-    path[sizeof(addr.un.sun_path)] = '\0';
-    return path;
-}
-
-#else /* HAVE_SYS_UN_H */
-
-char *virGetUNIXSocketPath(int fd ATTRIBUTE_UNUSED)
-{
-    virReportSystemError(ENOSYS, "%s",
-                         _("UNIX sockets not supported on this platform"));
-    return NULL;
-}
-
-#endif /* HAVE_SYS_UN_H */
-
 #ifndef WIN32
 long virGetSystemPageSize(void)
 {
index b9715e5e664f00a73a06d691dc13c81cea641ba7..7ea702f27a9909e6870c1bb8fbcec2be8a23162b 100644 (file)
@@ -149,8 +149,6 @@ bool virIsSUID(void);
 time_t virGetSelfLastChanged(void);
 void virUpdateSelfLastChanged(const char *path);
 
-char *virGetUNIXSocketPath(int fd);
-
 long virGetSystemPageSize(void) ATTRIBUTE_NOINLINE;
 long virGetSystemPageSizeKB(void) ATTRIBUTE_NOINLINE;