X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=4b91660d5e12bf3119da6daee0ee9af32ee2fe73;hb=0d5b38f1d957609f3f96739507f491a6672f01d5;hp=d16826f04165f7f0d9420934349277d2a5e15283;hpb=e645763007e7097c14c1c3ba94010f2e32e536bf;p=libguestfs.git diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index d16826f..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; @@ -945,7 +957,7 @@ device_name_translation (char *device, const char *func) } /* If the name begins with "/dev/sd" then try the alternatives. */ - if (strncmp (device, "/dev/sd", 7) != 0) + if (STRNEQLEN (device, "/dev/sd", 7)) goto error; device[5] = 'h'; /* /dev/hd (old IDE driver) */ @@ -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: + ; + } }