This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git
The following commit(s) were added to refs/heads/master by this push:
new 83ee87e Better handling for error cases
83ee87e is described below
commit 83ee87e6a9d1da9e20d0349e60d73ebc8848f671
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 17 17:06:13 2025 +0000
Better handling for error cases
---
src/native/windows/apps/prunsrv/prunsrv.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/native/windows/apps/prunsrv/prunsrv.c
b/src/native/windows/apps/prunsrv/prunsrv.c
index 76bb997..c870fdd 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.c
+++ b/src/native/windows/apps/prunsrv/prunsrv.c
@@ -1922,11 +1922,12 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
/* wait 2 seconds */
DWORD rv = apxHandleWait(gWorker, 2000, FALSE);
if (rv == WAIT_OBJECT_0 && _exe_shutdown) {
- /* Normal exit. NO-OP */
- } else if (rv != WAIT_OBJECT_0 && !_exe_shutdown) {
+ /* Normal exit. NO-OP. */
+ } else if (rv == WAIT_TIMEOUT && !_exe_shutdown) {
/* Normal running. */
apxLogWrite(APXLOG_MARK_DEBUG "waiting until Worker is
done...");
} else if (rv == WAIT_OBJECT_0 && !_exe_shutdown) {
+ /* Exit before stop was called, */
if (_jni_startup) {
/* JNI mode not being used correctly */
if (!bLoopWarningIssued) {
@@ -1942,7 +1943,10 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
} else if (rv != WAIT_OBJECT_0 && _exe_shutdown) {
/* Stop has been called but service worker has not yet
stopped. */
/* do ... while loop will exit and stop timeout will be
processed. */
- }
+ } else if (rv == WAIT_ABANDONED || rv == WAIT_FAILED) {
+ apxLogWrite(APXLOG_MARK_ERROR "Service '%S' has terminated
abnormally.", _service_name);
+ break;
+ }
} while (!_exe_shutdown);
/* calculate remaing timeout */