1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

virfile: Resolve Coverity DEADCODE

Adjust the parentheses in/for the waitpid loops; otherwise, Coverity
points out:

(1) Event assignment:   Assigning: "waitret" = "waitpid(pid, &status, 0) == -1"
(2) Event between:      At condition "waitret == -1", the value of "waitret"
                        must be between 0 and 1.
(3) Event dead_error_condition:     The condition "waitret == -1" cannot
                        be true.
(4) Event dead_error_begin:     Execution cannot reach this statement:
                        "ret = -*__errno_location();".

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2014-09-04 14:46:34 -04:00
parent daf27d4d82
commit 6825bdad13

View File

@ -2072,8 +2072,7 @@ virFileOpenForked(const char *path, int openflags, mode_t mode,
} }
/* wait for child to complete, and retrieve its exit code */ /* wait for child to complete, and retrieve its exit code */
while ((waitret = waitpid(pid, &status, 0) == -1) while ((waitret = waitpid(pid, &status, 0)) == -1 && errno == EINTR);
&& (errno == EINTR));
if (waitret == -1) { if (waitret == -1) {
ret = -errno; ret = -errno;
virReportSystemError(errno, virReportSystemError(errno,
@ -2290,7 +2289,7 @@ virDirCreate(const char *path,
if (pid) { /* parent */ if (pid) { /* parent */
/* wait for child to complete, and retrieve its exit code */ /* wait for child to complete, and retrieve its exit code */
VIR_FREE(groups); VIR_FREE(groups);
while ((waitret = waitpid(pid, &status, 0) == -1) && (errno == EINTR)); while ((waitret = waitpid(pid, &status, 0)) == -1 && errno == EINTR);
if (waitret == -1) { if (waitret == -1) {
ret = -errno; ret = -errno;
virReportSystemError(errno, virReportSystemError(errno,