X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=db0bff926de99cb89d4003e6c5ed3c9a9917aa42;hb=b296287daf9b884aa38646717725f5a389f96ca5;hp=b6c3c4483065598522c098aa751210c3b644d42a;hpb=3cf719bc077a5f0d4f1a79279a5ba6e41d53c9b9;p=libguestfs.git diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index b6c3c44..db0bff9 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; @@ -641,7 +641,7 @@ commandvf (char **stdoutput, char **stderror, int flags, */ 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]; @@ -746,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); + } } } } @@ -831,7 +831,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 +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) */