virProcessKillPainfullyDelay() currently almost always returns 1 or -1,
even though the documentation indicates that it should return 0 if the
process was terminated gracefully. But the computation of the return
code is faulty and the only case that it currently returns 0 is when it
is called with the pid of a process that does not exist.
Since no callers ever even distinguish between the 0 and 1 response
codes, simply get rid of the distinction and return 0 for both cases.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
Change in v2:
- just drop the distinction between 0 and 1 and always return 0.
Suggested by Ján Tomko
src/util/virprocess.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 6ce5ef99a9..b6fb17db83 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -363,9 +363,8 @@ pid_t virProcessGroupGet(pid_t pid)
/*
* Try to kill the process and verify it has exited
*
- * Returns 0 if it was killed gracefully, 1 if it
- * was killed forcibly, -1 if it is still alive,
- * or another error occurred.
+ * Returns 0 if it was killed, -1 if it is still alive or another error
+ * occurred.
*
* Callers can provide an extra delay in seconds to
* wait longer than the default.
@@ -426,7 +425,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int
extradelay, boo
(long long)pid, signame);
return -1;
}
- return signum == SIGTERM ? 0 : 1;
+ return 0;
}
g_usleep(200 * 1000);
--
2.41.0