diff --git a/m4/virt-external-programs.m4 b/m4/virt-external-programs.m4 index 3c915e1a65fbfa4aea9a0e69a6f415e0535423dc..f1ae104b32fe5762dc33c3784793d724b5941e74 100644 --- a/m4/virt-external-programs.m4 +++ b/m4/virt-external-programs.m4 @@ -45,7 +45,7 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [ AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([RADVD], [radvd], [radvd], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([TC], [tc], [tc], [$LIBVIRT_SBIN_PATH]) - AC_PATH_PROG([UDEVADM], [udevadm], [], [$LIBVIRT_SBIN_PATH]) + AC_PATH_PROG([UDEVADM], [udevadm], [udevadm], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([MODPROBE], [modprobe], [modprobe], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([RMMOD], [rmmod], [rmmod], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([MMCTL], [mm-ctl], [mm-ctl], [$LIBVIRT_SBIN_PATH]) @@ -65,11 +65,8 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [ [Location or name of the mm-ctl program]) AC_DEFINE_UNQUOTED([OVSVSCTL], ["$OVSVSCTL"], [Location or name of the ovs-vsctl program]) - - if test -n "$UDEVADM"; then - AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"], - [Location or name of the udevadm program]) - fi + AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"], + [Location or name of the udevadm program]) if test -n "$MODPROBE"; then AC_DEFINE_UNQUOTED([MODPROBE], ["$MODPROBE"], [Location or name of the modprobe program]) diff --git a/src/util/virutil.c b/src/util/virutil.c index ecef24d2f3da1f2fbf85d511d50a744cebc77767..b85769d9360d1c42e38c16335241855ec60c9e94 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1479,25 +1479,24 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, #endif -#if defined(UDEVADM) void virWaitForDevices(void) { - const char *const settleprog[] = { UDEVADM, "settle", NULL }; + VIR_AUTOPTR(virCommand) cmd = NULL; + VIR_AUTOFREE(char *) udev = NULL; int exitstatus; - if (access(settleprog[0], X_OK) != 0) + if (!(udev = virFindFileInPath(UDEVADM))) + return; + + if (!(cmd = virCommandNewArgList(udev, "settle", NULL))) return; /* * NOTE: we ignore errors here; this is just to make sure that any device * nodes that are being created finish before we try to scan them. */ - ignore_value(virRun(settleprog, &exitstatus)); + ignore_value(virCommandRun(cmd, &exitstatus)); } -#else -void virWaitForDevices(void) -{} -#endif #if WITH_DEVMAPPER bool