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
commit 36bdde050c5c27c113f2a194ab8844f0fd79e92f Author: Mark Thomas <[email protected]> AuthorDate: Wed Jan 7 08:43:32 2026 +0000 lockf requires file to be opened in read/write mode This bug was exposed by #f361cf15 which added error checking and early return on failure. The addition of the early return on failure created a regression in 1.5.1. --- src/changes/changes.xml | 1 + src/native/unix/native/jsvc-unix.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 79cf412..47e2e93 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -42,6 +42,7 @@ <body> <release version="1.5.2" date="YYYY-MM-DD" description="Bug fix release"> <!-- FIX --> + <action type="fix" dev="markt" due-to="Alex Dupre and Michael Osipov">jsvc. Fix a regression in 1.5.1 that exposed a long standing bug around the use of lockf(3) and pid files.</action> <!-- ADD --> <!-- UPDATE --> <action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 93 to 94.</action> diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c index 9c8c944..cdf014c 100644 --- a/src/native/unix/native/jsvc-unix.c +++ b/src/native/unix/native/jsvc-unix.c @@ -673,7 +673,7 @@ static int get_pidf(arg_data *args, bool quiet) int i; char buff[80]; - fd = open(args->pidf, O_RDONLY, 0); + fd = open(args->pidf, O_RDWR, 0); if (!quiet) log_debug("get_pidf: %d in %s", fd, args->pidf); if (fd < 0) { @@ -778,7 +778,7 @@ static int wait_child(arg_data *args, int pid) } /* check if the pid file process exists */ - fd = open(args->pidf, O_RDONLY); + fd = open(args->pidf, O_RDWR); if (fd < 0 && havejvm) { /* something has gone wrong the JVM has stopped */ return 1;
