summary refs log tree commit diff
diff options
context:
space:
mode:
authorColin Booth <colin@heliocat.net>2021-02-04 23:52:25 -0800
committerDuncan Overbruck <github@duncano.de>2021-02-12 23:20:28 +0100
commitceb8dd4c132be54f421fb255101e503fac42aa58 (patch)
tree3a3b1ea2b61c7e46ee42c455521223a364d9a091
parent13b21ac1dfdb098a785e897618b25f7cffddc6a5 (diff)
downloadrunit-void-ceb8dd4c132be54f421fb255101e503fac42aa58.tar.gz
runit-void-ceb8dd4c132be54f421fb255101e503fac42aa58.tar.xz
runit-void-ceb8dd4c132be54f421fb255101e503fac42aa58.zip
services/agetty-generic: use chpst -P instead of setsid
The setsid program has a surprise gotcha of backgrounding a process if
it already happens to be the session leader. This is ok for runit which
never sets the service as a session leader but does not work with other
supervisors which might. chpst provides the same setsid(2) functionality
without also having the gotcha.

Be aware that chpst has issues around gidlist squashing when using
the -u or -U options without explicit passing. This behavior is not
triggered in this case since chpst is being run as root and not being
asked to drop privileges.
-rwxr-xr-xservices/agetty-generic/run2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/agetty-generic/run b/services/agetty-generic/run
index 41a8cf7..a4cfb06 100755
--- a/services/agetty-generic/run
+++ b/services/agetty-generic/run
@@ -12,5 +12,5 @@ elif [ -x /sbin/agetty -o -x /bin/agetty ]; then
 	GETTY=agetty
 fi
 
-exec setsid ${GETTY} ${GETTY_ARGS} \
+exec chpst -P ${GETTY} ${GETTY_ARGS} \
 	"${tty}" "${BAUD_RATE}" "${TERM_NAME}"