Module Name: src Committed By: kre Date: Thu Jul 21 07:53:28 UTC 2022
Modified Files: src/etc/root: dot.shrc Log Message: Cleanup the "hup" function - quote properly, and test for the pid file existing (with something in it) before simply using it, so the error message can be controlled, rather than just sh's cannot open file msg. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/etc/root/dot.shrc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/etc/root/dot.shrc diff -u src/etc/root/dot.shrc:1.8 src/etc/root/dot.shrc:1.9 --- src/etc/root/dot.shrc:1.8 Sat Nov 24 11:14:41 2007 +++ src/etc/root/dot.shrc Thu Jul 21 07:53:28 2022 @@ -1,10 +1,17 @@ -# $NetBSD: dot.shrc,v 1.8 2007/11/24 11:14:41 pavel Exp $ +# $NetBSD: dot.shrc,v 1.9 2022/07/21 07:53:28 kre Exp $ if [ -f /etc/shrc ]; then . /etc/shrc fi -hup(){ (read pid; kill -HUP $pid) </var/run/$1.pid; } +hup() +{ + test -s "/var/run/$1.pid" || { + printf >&2 'No pid file for %s\n' "$1" + return 1 + } + { read pid; kill -HUP "$pid"; } <"/var/run/$1.pid" +} case "$-" in *i*) # interactive mode settings go here