On 08/29/2018 09:03 AM, Eric Blake wrote:
Detected by dcb:
dutil_posix.c:225]: (style) Suspicious condition (assignment + comparison); Clarify
expression with parentheses.
Without the patch, waitret can only ever be 0 or 1, which renders
the next line's check for -1 dead code.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/dutil_posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dutil_posix.c b/src/dutil_posix.c
index 1313514..11ccff6 100644
--- a/src/dutil_posix.c
+++ b/src/dutil_posix.c
@@ -220,7 +220,7 @@ int run_program(struct netcf *ncf, const char *const *argv, char
**output)
fclose(outfile);
outfile = NULL;
- while ((waitret = waitpid(childpid, &exitstatus, 0) == -1) &&
+ while (((waitret = waitpid(childpid, &exitstatus, 0)) == -1) &&
Could also be spelled:
while ((waitret = waitpid(childpid, &exitstatus, 0)) == -1 &&
errno == EINTR) {
/* empty loop */
}
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org