Created attachment 394530 [details, diff] vsftpd.init.patch vsftpd can generate multiple child processes but the current stop script will only stop the parent task listed in the pid file but none of its children. it would seem the best solution would be to use pgrep to search for vsftpd processes and placing those pid's into the proper pidfile. however, start-stop-daemon doesn't seem to support multiple pid's in the pidfile (at least, i couldn't figure out to make it work) so i propose an alternative solution: use start-stop-daemon to kill the parent process listed in the pid file and then use pkill to kill any child processes. this solution will also work in the instance where no pidfile can be found. note that the current stop script does not work properly in the no-pidfile case. it tries to stop all processes with the name $SVCNAME. however, in the case of multiple virtual ftp servers, $SVCNAME will be of the form vsftpd.server-1 so it will never find any processes (because they are all named vsftpd). the new code for the stop script is below. note that this works properly in the normal (default) case where vsftpd is running as a single ftp server, as well as the case where it is running as multiple, virtual ftp servers. stop() { ebegin "Stopping ${SVCNAME}" local retval=0 if [ -f ${VSFTPD_PID} ]; then start-stop-daemon --stop --pidfile ${VSFTPD_PID} || retval=1 pkill --full ${VSFTPD_CONF} else ewarn "Couldn't find ${VSFTPD_PID} trying to stop using the config filename ${VSFTPD_CONF}" pgrep --full ${VSFTPD_CONF} > ${VSFTPD_PID} start-stop-daemon --stop --pidfile ${VSFTPD_PID} || retval=1 pkill --full ${VSFTPD_CONF} fi eend ${retval} }
The patch looks good to me. Sadly I have no openrc installation to test it so I just merged it as is. Thanks +*vsftpd-3.0.2-r4 (31 Jan 2015) + + 31 Jan 2015; Markos Chandras <hwoarang@gentoo.org> +vsftpd-3.0.2-r4.ebuild, + files/vsftpd.init: + Make sure child processes are killed properly. Bug #537290 by rhumbliner +