Use stub for virNetDevGetName on mingw

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 5dd607059d

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2017-03-27 21:49:06 +02:00
parent 5498aa29a7
commit 0fc454cec0
2 changed files with 14 additions and 3 deletions

View 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 \

View 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: