X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=4b91660d5e12bf3119da6daee0ee9af32ee2fe73;hb=0d5b38f1d957609f3f96739507f491a6672f01d5;hp=61a62368a0c5731fbb14c55ecc98af59a7f90baa;hpb=627f89351d06e43564b47ea42cabaa522284c2a1;p=libguestfs.git diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 61a6236..4b91660 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -27,15 +27,27 @@ #include #include #include -#include #include -#include #include -#include #include #include #include + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#ifdef HAVE_PRINTF_H #include +#endif #include "c-ctype.h" #include "ignore-value.h" @@ -226,7 +238,7 @@ main (int argc, char *argv[]) /* Connect to vmchannel. */ int sock = -1; - if (strncmp (vmchannel, "tcp:", 4) == 0) { + if (STREQLEN (vmchannel, "tcp:", 4)) { /* Resolve the hostname. */ struct addrinfo *res, *rr; struct addrinfo hints; @@ -831,7 +843,7 @@ split_lines (char *str) int size = 0, alloc = 0; char *p, *pend; - if (strcmp (str, "") == 0) + if (STREQ (str, "")) goto empty_list; p = str; @@ -976,5 +988,25 @@ device_name_translation (char *device, const char *func) void udev_settle (void) { - command (NULL, NULL, "/sbin/udevadm", "settle", NULL); + static int which_prog = 0; + + if (which_prog == 0) { + if (access ("/sbin/udevsettle", X_OK) == 0) + which_prog = 2; + else if (access ("/sbin/udevadm", X_OK) == 0) + which_prog = 1; + else + which_prog = 3; + } + + switch (which_prog) { + case 1: + command (NULL, NULL, "/sbin/udevadm", "settle", NULL); + break; + case 2: + command (NULL, NULL, "/sbin/udevsettle", NULL); + break; + default: + ; + } }