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 1f6f0eb Fix compilation warnings / improve error messages.
1f6f0eb is described below
commit 1f6f0eb2d10b97158522648c626e07e11eac707b
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jan 7 09:18:27 2026 +0000
Fix compilation warnings / improve error messages.
---
src/native/unix/native/jsvc-unix.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/native/unix/native/jsvc-unix.c
b/src/native/unix/native/jsvc-unix.c
index 4f49f85..b362e8f 100644
--- a/src/native/unix/native/jsvc-unix.c
+++ b/src/native/unix/native/jsvc-unix.c
@@ -589,7 +589,7 @@ retry:
}
else {
if (lockf(fd, F_LOCK, 0)) {
- log_error("check_pid: Failed to lock PID file [%s] with file
descriptor [%d] for reading due to [%d]",
+ log_error("check_pid: Failed to lock PID file [%s] with file
descriptor [%d] due to [%d]",
args->pidf, fd, errno);
return -1;
}
@@ -608,12 +608,18 @@ retry:
}
}
lseek(fd, 0, SEEK_SET);
- ftruncate(fd, 0);
+ if (ftruncate(fd, 0)) {
+ log_error("check_pid: Failed to truncate PID file [%s] with file
descriptor [%d] due to [%d]",
+ args->pidf, fd, errno);
+ }
i = snprintf(buff, sizeof(buff), "%d\n", (int)getpid());
- write(fd, buff, i);
+ if (write(fd, buff, i) == -1) {
+ log_error("check_pid: Failed to write new PID to PID file [%s]
with file descriptor [%d] due to [%d]",
+ args->pidf, fd, errno);
+ }
fsync(fd);
if (lockf(fd, F_ULOCK, 0)) {
- log_error("check_pid: Failed to unlock PID file [%s] with file
descriptor [%d] after reading due to [%d]",
+ log_error("check_pid: Failed to unlock PID file [%s] with file
descriptor [%d] due to [%d]",
args->pidf, fd, errno);
}
close(fd);