]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Use stub for virNetDevGetName on mingw
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 19:49:06 +0000 (21:49 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 20:26:21 +0000 (22:26 +0200)
If if_indextoname is not defined, the whole function using it should
not be defined either.  Add stub to fix build on mingw.

Caused by 5dd607059d8a98e04024305ae4afbd038aadbdcd

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
configure.ac
src/util/virnetdev.c

index cf50422d5dab9b6f3c4a0f3ced7fb01b11ca21ac..08051d53aa0a2698ddd2e350c9c204d04e0a79d7 100644 (file)
@@ -319,9 +319,10 @@ AC_CHECK_SIZEOF([long])
 dnl Availability of various common functions (non-fatal if missing),
 dnl and various less common threadsafe functions
 AC_CHECK_FUNCS_ONCE([cfmakeraw fallocate geteuid getgid getgrnam_r \
-  getmntent_r getpwuid_r getrlimit getuid kill mmap newlocale posix_fallocate \
-  posix_memalign prlimit regexec sched_getaffinity setgroups setns \
-  setrlimit symlink sysctlbyname getifaddrs sched_setscheduler unshare])
+  getmntent_r getpwuid_r getrlimit getuid if_indextoname kill mmap \
+  newlocale posix_fallocate posix_memalign prlimit regexec \
+  sched_getaffinity setgroups setns setrlimit symlink sysctlbyname \
+  getifaddrs sched_setscheduler unshare])
 
 dnl Availability of various common headers (non-fatal if missing).
 AC_CHECK_HEADERS([pwd.h regex.h sys/un.h \
index 47e2b20d56a15bd9739cc08d7c45cca5295c8683..170e34827f12582db273184a76e9dd90291ec5d6 100644 (file)
@@ -852,6 +852,7 @@ virNetDevGetRcvAllMulti(const char *ifname,
     return virNetDevGetIFFlag(ifname, VIR_IFF_ALLMULTI, receive);
 }
 
+#if defined(HAVE_IF_INDEXTONAME)
 char *virNetDevGetName(int ifindex)
 {
     char name[IFNAMSIZ];
@@ -871,6 +872,15 @@ char *virNetDevGetName(int ifindex)
  cleanup:
      return ifname;
 }
+#else
+char *virNetDevGetName(int ifindex)
+{
+    virReportSystemError(ENOSYS,
+                         _("Cannot get interface name for index '%i'"),
+                         ifindex);
+    return NULL;
+}
+#endif
 
 /**
  * virNetDevGetIndex: