On 18/12/2015 13:21, Daniel P. Berrange wrote: > +#ifndef WIN32 > +static int qio_channel_command_abort(QIOChannelCommand *ioc, > + Error **errp) > +{ > + pid_t ret; > + int status; > + int step = 0; > + > + /* See if intermediate process has exited; if not, try a nice > + * SIGTERM followed by a more severe SIGKILL. > + */ > + rewait: > + trace_qio_channel_command_abort(ioc, ioc->pid); > + ret = waitpid(ioc->pid, &status, WNOHANG); > + trace_qio_channel_command_wait(ioc, ioc->pid, ret, status); > + if (ret == (pid_t)-1) { > + if (errno == EINTR) { > + goto rewait; > + } else { > + error_setg_errno(errp, errno, > + "Cannot wait on pid %llu", > + (unsigned long long)ioc->pid); > + return -1; > + } > + } else if (ret == 0) { > + if (step == 0) { > + kill(ioc->pid, SIGTERM); > + } else if (step == 1) { > + kill(ioc->pid, SIGKILL);
Hi Daniel, Coverity complains here that step is never set to 1. Paolo > + } else { > + error_setg(errp, > + "Process %llu refused to die", > + (unsigned long long)ioc->pid); > + return -1; > + } > + usleep(10 * 1000); > + goto rewait; > + } > + > + return 0; > +} > +#endif /* ! WIN32 */ > +