Date: Sun, 07 Jun 2026 21:19:41 +0000 From: Christos Margiolis <christos@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 91167d0b66e8 - stable/15 - rc: virtual_oss: Handle absent pidfile properly Message-ID: <6a25e06d.1875e.93ef7bf@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=91167d0b66e8a377a12b76d4cc6e4808000e1718 commit 91167d0b66e8a377a12b76d4cc6e4808000e1718 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2026-05-21 16:53:27 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2026-06-07 21:19:34 +0000 rc: virtual_oss: Handle absent pidfile properly Instead of throwing errors from the programs that use it, print a warning if the file does not exist. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: 0mp, jrm Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/33 (cherry picked from commit b2677d002edbe9308b1f8cecd1a5fc515d2a5deb) --- libexec/rc/rc.d/virtual_oss | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libexec/rc/rc.d/virtual_oss b/libexec/rc/rc.d/virtual_oss index dd3bbe41c094..9861545b8bfc 100644 --- a/libexec/rc/rc.d/virtual_oss +++ b/libexec/rc/rc.d/virtual_oss @@ -76,12 +76,17 @@ stop_instance() if [ -z "${instance_args}" ]; then warn "no such config: ${config}" else - pid="$(cat "${pidpath}/${config}.pid")" - startmsg -n "Stopping virtual_oss config: ${config}: " - kill "${pid}" - pwait "${pid}" - rm -f "${pidpath}/${config}.pid" - startmsg "done" + pidfile="${pidpath}/${config}.pid" + if [ ! -f "${pidfile}" ]; then + warn "not running: ${config}" + else + pid="$(cat "${pidfile}")" + startmsg -n "Stopping virtual_oss config: ${config}: " + kill "${pid}" + pwait "${pid}" + rm -f "${pidfile}" + startmsg "done" + fi fi }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a25e06d.1875e.93ef7bf>
