X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=5789fedabe47962b24a5833bf136140b74669035;hp=370eea8ddcdabc668804dd4e307cadbc1fbdfd8a;hb=3e70b34eed5a48640e20fbf6dcba774aaace1f3c;hpb=a25d175cf6e8283288fd6d209b37b09ffee0dcf3 diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 370eea8..5789fed 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -226,7 +226,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; @@ -548,7 +548,7 @@ commandf (char **stdoutput, char **stderror, int flags, const char *name, ...) va_end (args); - r = commandvf (stdoutput, stderror, flags, (char **) argv); + r = commandvf (stdoutput, stderror, flags, (const char * const*) argv); /* NB: Mustn't free the strings which are on the stack. */ free (argv); @@ -605,7 +605,8 @@ commandrf (char **stdoutput, char **stderror, int flags, const char *name, ...) /* Same as 'command', but passing an argv. */ int -commandvf (char **stdoutput, char **stderror, int flags, char *const *argv) +commandvf (char **stdoutput, char **stderror, int flags, + char const *const *argv) { int r; @@ -640,7 +641,7 @@ commandvf (char **stdoutput, char **stderror, int flags, char *const *argv) */ int commandrvf (char **stdoutput, char **stderror, int flags, - char const* const *argv) + char const* const *argv) { int so_size = 0, se_size = 0; int so_fd[2], se_fd[2]; @@ -745,19 +746,19 @@ commandrvf (char **stdoutput, char **stderror, int flags, if (r == 0) { FD_CLR (se_fd[0], &rset); quit++; } if (r > 0) { - if (verbose) - ignore_value (write (2, buf, r)); - - if (stderror) { - se_size += r; - p = realloc (*stderror, se_size); - if (p == NULL) { - perror ("realloc"); - goto quit; - } - *stderror = p; - memcpy (*stderror + se_size - r, buf, r); - } + if (verbose) + ignore_value (write (2, buf, r)); + + if (stderror) { + se_size += r; + p = realloc (*stderror, se_size); + if (p == NULL) { + perror ("realloc"); + goto quit; + } + *stderror = p; + memcpy (*stderror + se_size - r, buf, r); + } } } } @@ -944,7 +945,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) */