Compare commits
	
		
			30 Commits
		
	
	
		
			openrc-0.2
			...
			openrc-0.2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 52711bdca7 | ||
|   | 53902cefb8 | ||
|   | 75f991068d | ||
|   | e499e58310 | ||
|   | b08b6cd91b | ||
|   | 3c2b93fc9c | ||
|   | b5d829789f | ||
|   | 1e3442f95d | ||
|   | 2bda1871a1 | ||
|   | d3b111bd58 | ||
|   | dbea63b76d | ||
|   | 6a5287dbb5 | ||
|   | df8eeba2fb | ||
|   | 54fce42c6f | ||
|   | 54d7aa39dd | ||
|   | dc5d63aa97 | ||
|   | bab5d7767d | ||
|   | 799686e40d | ||
|   | d83ae59cca | ||
|   | 18b4108755 | ||
|   | e96347523f | ||
|   | f0aacec02e | ||
|   | 57e1dd7389 | ||
|   | c89b3763fb | ||
|   | 425abe40c5 | ||
|   | 725b9dc89c | ||
|   | 22d650c450 | ||
|   | 809ac86c69 | ||
|   | b3310e8e10 | ||
|   | 29369c44c1 | 
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ | ||||
| # All rights reserved. Released under the 2-clause BSD license. | ||||
|  | ||||
| NAME=		openrc | ||||
| VERSION=	0.2.2 | ||||
| VERSION=	0.2.3 | ||||
| PKG=		${NAME}-${VERSION} | ||||
|  | ||||
| SUBDIR=		conf.d doc etc init.d man net sh src | ||||
|   | ||||
| @@ -3,5 +3,8 @@ SRCS=	avahi-dnsconfd.in avahid.in dbus.in hald.in named.in ntpd.in \ | ||||
| 	openvpn.in polkitd.in sshd.in | ||||
|  | ||||
| MK=	../mk | ||||
|  | ||||
| SED_EXTRA+= -e 's:@VARBASE@:/var:g' | ||||
|  | ||||
| include ${MK}/scripts.mk | ||||
| include Makefile.${OS} | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| # All rights reserved. Released under the 2-clause BSD license. | ||||
|  | ||||
| command=@PKG_PREFIX@/bin/dbus-daemon | ||||
| pidfile=@VARBASE@/run/dbus/dbus.pid | ||||
| pidfile=@VARBASE@/run/dbus/pid | ||||
| command_args="${dbusd_args---system}" | ||||
| name="Message Bus Daemon" | ||||
|  | ||||
|   | ||||
| @@ -4,12 +4,22 @@ | ||||
|  | ||||
| command=/usr/sbin/named | ||||
| command_args=${named_args} | ||||
| pidfile=@VARBASE@/run/named/pid | ||||
| pidfile=@VARBASE@/run/named.pid | ||||
| name="Domain Name server" | ||||
| extra_started_commands="reload" | ||||
|  | ||||
| namedb=/etc/namedb | ||||
| named_uid=${named_uid:-bind} | ||||
| uid=named | ||||
| case "${RC_UNAME}" in | ||||
| 	FreeBSD) | ||||
| 		uid=bind | ||||
| 		pidfile=@VARBASE@/run/named/pid | ||||
| 		;; | ||||
| 	Linux) | ||||
| 		uid=bind | ||||
| 		;; | ||||
| esac | ||||
| named_uid=${named_uid:-${uid}} | ||||
|  | ||||
| depend() | ||||
| { | ||||
|   | ||||
| @@ -27,14 +27,21 @@ _reboot() { | ||||
|  | ||||
| start() | ||||
| { | ||||
| 	local reboot_opts= fsck_opts= p= | ||||
| 	local reboot_opts= fsck_opts= p= check_extra= | ||||
|  | ||||
| 	if [ -e /fastboot ]; then | ||||
| 		ewarn "Skipping fsck due to /fastboot" | ||||
| 		return 0 | ||||
| 	fi | ||||
| 	if [ -e /forcefsck ]; then | ||||
| 		fsck_opts="${fsck_opts} -f" | ||||
| 		check_extra="(check forced)" | ||||
| 	fi | ||||
|  | ||||
| 	ebegin "Checking local filesystems" | ||||
| 	if [ -n "${fsck_passno}" ]; then | ||||
| 		check_extra="[passno ${fsck_passno}] ${check_extra}" | ||||
| 	fi | ||||
| 	ebegin "Checking local filesystems ${check_extra}" | ||||
| 	for p in ${fsck_passno}; do | ||||
| 		local IFS="${_IFS}" | ||||
| 		case "${p}" in | ||||
| @@ -45,7 +52,7 @@ start() | ||||
| 	done | ||||
|  | ||||
| 	if [ "${RC_UNAME}" = "Linux" ]; then | ||||
| 		fsck_opts="-C0 -T" | ||||
| 		fsck_opts="${fsck_opts} -C0 -T" | ||||
| 		if [ -z "${fsck_passno}" ]; then | ||||
| 			fsck_args=${fsck_args--A -p} | ||||
| 			if echo 2>/dev/null >/.test.$$; then | ||||
|   | ||||
| @@ -28,6 +28,7 @@ sync; sync | ||||
| #   1) we don't need (and by default can't) umount anything (VServer) or | ||||
| #   2) the host utils take care of all umounting stuff (OpenVZ) | ||||
| if [ "${RC_SYS}" = "VSERVER" -o "${RC_SYS}" = "OPENVZ" ]; then | ||||
| 	[ "${RC_SYS}" = "OPENVZ" -a "$1" = "reboot" ] && echo "" > /reboot | ||||
| 	if [ -e @SYSCONFDIR@/init.d/"$1".sh ]; then | ||||
| 		. @SYSCONFDIR@/init.d/"$1".sh | ||||
| 	else | ||||
|   | ||||
| @@ -26,7 +26,7 @@ start() | ||||
| 		local usbfs=$(grep -Fow usbfs /proc/filesystems || | ||||
| 					  grep -Fow usbdevfs /proc/filesystems) | ||||
| 		if [ -n "${usbfs}" ]; then | ||||
| 			ebegin "Mounting USB device filesystem (${usbfs})" | ||||
| 			ebegin "Mounting USB device filesystem [${usbfs}]" | ||||
| 			local usbgid="$(getent group usb | \ | ||||
| 				sed -e 's/.*:.*:\(.*\):.*/\1/')" | ||||
| 			mount -t ${usbfs} \ | ||||
|   | ||||
| @@ -13,7 +13,7 @@ depend() | ||||
| start() | ||||
| { | ||||
| 	if echo 2>/dev/null >/.test.$$; then | ||||
| 		rm -f /.test.$$ /fastboot | ||||
| 		rm -f /.test.$$ /fastboot /forcefsck | ||||
| 		return 0 | ||||
| 	fi | ||||
|  | ||||
| @@ -22,6 +22,7 @@ start() | ||||
| 		Linux)	mount -n -o remount,rw /;; | ||||
| 		*)	mount -u -o rw /;; | ||||
| 	esac | ||||
| 	eend $? "Root filesystem could not be mounted read/write" | ||||
| 	rm -f /fastboot | ||||
| 	if eend $? "Root filesystem could not be mounted read/write"; then | ||||
| 		rm -f /fastboot /forcefsck | ||||
| 	fi | ||||
| } | ||||
|   | ||||
| @@ -151,9 +151,12 @@ _delete_addresses() | ||||
| { | ||||
| 	einfo "Removing addresses" | ||||
| 	eindent | ||||
| 	LC_ALL=C ifconfig "${IFACE}" | while read inet address rest; do | ||||
| 	LC_ALL=C ifconfig "${IFACE}" | while read inet address ali rest; do | ||||
| 		case "${inet}" in | ||||
| 			inet|inet6) | ||||
| 				if [ "${address}" = "alias" ]; then | ||||
| 					address="${ali}" | ||||
| 				fi | ||||
| 				case "${address}" in | ||||
| 					*"%${IFACE}"|::1) continue;; | ||||
| 					127.0.0.1) [ "${IFACE}" = "lo0" ] && continue;; | ||||
|   | ||||
| @@ -56,7 +56,7 @@ _set_flag() | ||||
| _get_mac_address() | ||||
| { | ||||
| 	local mac=$(LC_ALL=C ifconfig "${IFACE}" | \ | ||||
| 	sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p') | ||||
| 	sed -n -e 's/.* \(HWaddr\|ether\) \(..:..:..:..:..:..\).*/\2/p') | ||||
|  | ||||
| 	case "${mac}" in | ||||
| 		00:00:00:00:00:00);; | ||||
| @@ -77,7 +77,7 @@ _set_mac_address() | ||||
| _get_inet_address() | ||||
| { | ||||
| 	set -- $(LC_ALL=C ifconfig "${IFACE}" | | ||||
| 	sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p') | ||||
| 	sed -n -e 's/.*\(inet addr:\|inet \)\([^ ]*\).*\(Mask:\|netmask \)\([^ ]*\).*/\2 \4/p') | ||||
| 	[ -z "$1" ] && return 1 | ||||
|  | ||||
| 	echo -n "$1" | ||||
| @@ -145,7 +145,7 @@ _add_address() | ||||
| 	# IPv4 is tricky - ifconfig requires an aliased device | ||||
| 	# for multiple addresses | ||||
| 	local iface="${IFACE}" | ||||
| 	if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*"; then | ||||
| 	if LC_ALL=C ifconfig "${iface}" | grep -Eq '\<inet (addr:)?.*'; then | ||||
| 		# Get the last alias made for the interface and add 1 to it | ||||
| 		i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \ | ||||
| 			| sed -n -e 's/'"${iface}"'://p') | ||||
| @@ -234,7 +234,7 @@ _delete_addresses() | ||||
| 	# Remove IPv6 addresses | ||||
| 	local addr= | ||||
| 	for addr in $(LC_ALL=C ifconfig "${IFACE}" | \ | ||||
| 		sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p'); do | ||||
| 		sed -n -e 's/^.*\(inet6 addr:\|inet6\) \([^ ]*\) .*\(Scope:[^L]\|scopeid [^<]*<[^l]\).*/\2/p'); do | ||||
| 		[ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue | ||||
| 		einfo "${addr}" | ||||
| 		ifconfig "${IFACE}" inet6 del "${addr}" | ||||
|   | ||||
| @@ -189,7 +189,7 @@ iproute2_pre_start() | ||||
| 	# TX Queue Length support | ||||
| 	local len= | ||||
| 	eval len=\$txqueuelen_${IFVAR} | ||||
| 	[ -n "${len}" ] && ip link set txqueuelen "${len}" dev "${IFACE}" | ||||
| 	[ -n "${len}" ] && ip link set qlen "${len}" dev "${IFACE}" | ||||
|  | ||||
| 	local tunnel= | ||||
| 	eval tunnel=\$iptunnel_${IFVAR} | ||||
|   | ||||
| @@ -414,8 +414,9 @@ iwconfig_connect_preferred() | ||||
| 	[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps") | ||||
| 	[ $# = 0 ] && return 1 | ||||
|  | ||||
| 	local ssid= i=0 mode= mac= caps= freq= chan= | ||||
| 	local ssid= i= mode= mac= caps= freq= chan= | ||||
| 	for ssid; do | ||||
| 		i=0 | ||||
| 		while [ ${i} -le ${APS} ]  ; do | ||||
| 			eval e=\$SSID_${i} | ||||
| 			if [ "${e}" = "${ssid}" ] ; then | ||||
| @@ -484,7 +485,7 @@ iwconfig_defaults() | ||||
|  | ||||
| iwconfig_configure() | ||||
| { | ||||
| 	local x APS | ||||
| 	local x= APS=-1 | ||||
| 	eval SSID=\$ssid_${IFVAR} | ||||
|  | ||||
| 	# Setup ad-hoc mode? | ||||
|   | ||||
| @@ -525,7 +525,7 @@ iwconfig_force_preferred() | ||||
| 			i=$((${i} + 1)) | ||||
| 		done | ||||
| 		if ! ${found_AP}; then | ||||
| 			SSID=${e} | ||||
| 			SSID=${ssid} | ||||
| 			iwconfig_associate && return 0 | ||||
| 		fi | ||||
| 	done | ||||
| @@ -610,7 +610,7 @@ iwconfig_defaults() | ||||
|  | ||||
| iwconfig_configure() | ||||
| { | ||||
| 	local x= APS= | ||||
| 	local x= APS=-1 | ||||
| 	eval SSID=\$ssid_${IFVAR} | ||||
|  | ||||
| 	# Support old variable | ||||
|   | ||||
| @@ -48,7 +48,7 @@ do | ||||
|  | ||||
| 	cd "${_dir}" | ||||
| 	for RC_SERVICE in *; do | ||||
| 		[ -x "${RC_SERVICE}" ] || continue | ||||
| 		[ -x "${RC_SERVICE}" -a -f "${RC_SERVICE}" ] || continue | ||||
|  | ||||
| 		# Only generate dependencies for runscripts | ||||
| 		read one two < "${RC_SERVICE}" | ||||
|   | ||||
							
								
								
									
										30
									
								
								sh/net.sh.in
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								sh/net.sh.in
									
									
									
									
									
								
							| @@ -28,7 +28,7 @@ depend() | ||||
| 		*) after net.lo net.lo0;; | ||||
| 	esac | ||||
|  | ||||
| 	if type depend_${IFVAR} >/dev/null 2>&1; then | ||||
| 	if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then | ||||
| 		depend_${IFVAR} | ||||
| 	fi | ||||
|  | ||||
| @@ -344,7 +344,7 @@ _load_modules() | ||||
| 		# Wrap our provides | ||||
| 		local f= | ||||
| 		for f in pre_start start post_start; do  | ||||
| 			eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }" | ||||
| 			eval "${provides}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }" | ||||
| 		done | ||||
|  | ||||
| 		eval module_${mod}_provides="${provides}" | ||||
| @@ -358,7 +358,7 @@ _load_modules() | ||||
| 			eval x=\$module_${mod}_provides | ||||
| 			[ -z "${x}" ] && continue | ||||
| 			for f in pre_start start post_start; do  | ||||
| 				eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }" | ||||
| 				eval "${x}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }" | ||||
| 			done | ||||
| 			eval module_${x}_providedby="${mod}" | ||||
| 			;; | ||||
| @@ -462,7 +462,7 @@ start() | ||||
| 	# We up the iface twice if we have a preup to ensure it's up if | ||||
| 	# available in preup and afterwards incase the user inadvertently | ||||
| 	# brings it down | ||||
| 	if type preup >/dev/null 2>&1; then | ||||
| 	if [ "$(command -v preup)" = "preup" ]; then | ||||
| 		_up 2>/dev/null | ||||
| 		ebegin "Running preup" | ||||
| 		eindent | ||||
| @@ -473,7 +473,7 @@ start() | ||||
| 	_up 2>/dev/null | ||||
| 	 | ||||
| 	for module in ${MODULES}; do | ||||
| 		if type "${module}_pre_start" >/dev/null 2>&1; then | ||||
| 		if [ "$(command -v "${module}_pre_start")" = "${module}_pre_start" ]; then | ||||
| 			${module}_pre_start || exit $? | ||||
| 		fi | ||||
| 	done | ||||
| @@ -522,7 +522,7 @@ start() | ||||
| 			null) :;; | ||||
| 			[0-9]*|*:*) _add_address ${config};; | ||||
| 			*) | ||||
| 				if type "${config}_start" >/dev/null 2>&1; then | ||||
| 				if [ "$(command -v "${config}_start")" = "${config}_start" ]; then | ||||
| 					"${config}"_start | ||||
| 				else | ||||
| 					eerror "nothing provides \`${config}'" | ||||
| @@ -547,7 +547,7 @@ start() | ||||
| 	done | ||||
|  | ||||
| 	if ! ${oneworked}; then | ||||
| 		if type failup >/dev/null 2>&1; then | ||||
| 		if [ "$(command -v failup)" = "failup" ]; then | ||||
| 			ebegin "Running failup" | ||||
| 			eindent | ||||
| 			failup | ||||
| @@ -600,12 +600,12 @@ ${routes}" | ||||
| 	fi | ||||
|  | ||||
| 	for module in ${MODULES}; do | ||||
| 		if type "${module}_post_start" >/dev/null 2>&1; then | ||||
| 		if [ "$(command -v "${module}_post_start")" = "${module}_post_start" ]; then | ||||
| 			${module}_post_start || exit $? | ||||
| 		fi | ||||
| 	done | ||||
|  | ||||
| 	if type postup >/dev/null 2>&1; then | ||||
| 	if [ "$(command -v postup)" = "postup" ]; then | ||||
| 		ebegin "Running postup" | ||||
| 		eindent | ||||
| 		postup  | ||||
| @@ -628,7 +628,7 @@ stop() | ||||
| 		_load_modules false | ||||
| 	fi | ||||
|  | ||||
| 	if type predown >/dev/null 2>&1; then | ||||
| 	if [ "$(command -v predown)" = "predown" ]; then | ||||
| 		ebegin "Running predown" | ||||
| 		eindent | ||||
| 		predown || return 1 | ||||
| @@ -641,24 +641,24 @@ stop() | ||||
| 	fi | ||||
|  | ||||
| 	for module in ${MODULES}; do | ||||
| 		if type "${module}_pre_stop" >/dev/null 2>&1; then | ||||
| 		if [ "$(command -v "${module}_pre_stop")" = "${module}_pre_stop" ]; then | ||||
| 			${module}_pre_stop || exit $? | ||||
| 		fi | ||||
| 	done | ||||
|  | ||||
| 	for module in ${MODULES}; do | ||||
| 		if type "${module}_stop" >/dev/null 2>&1; then | ||||
| 		if [ "$(command -v "${module}_stop")" = "${module}_stop" ]; then | ||||
| 			${module}_stop | ||||
| 		fi | ||||
| 	done | ||||
|  | ||||
| 	# Only delete addresses for non PPP interfaces | ||||
| 	if ! type is_ppp >/dev/null 2>&1 || ! is_ppp; then | ||||
| 	if ! [ "$(command -v is_ppp)" = "is_ppp" ] || ! is_ppp; then | ||||
| 		_delete_addresses "${IFACE}" | ||||
| 	fi | ||||
|  | ||||
| 	for module in ${MODULES}; do | ||||
| 		if type "${module}_post_stop" >/dev/null 2>&1; then | ||||
| 		if [ "$(command -v "${module}_post_stop")" = "${module}_post_stop" ]; then | ||||
| 			${module}_post_stop | ||||
| 		fi | ||||
| 	done | ||||
| @@ -669,7 +669,7 @@ stop() | ||||
|  | ||||
| 	type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}" 2>/dev/null | ||||
|  | ||||
| 	if type postdown >/dev/null 2>&1; then | ||||
| 	if [ "$(command -v "postdown")" = "postdown" ]; then | ||||
| 		ebegin "Running postdown" | ||||
| 		eindent | ||||
| 		postdown | ||||
|   | ||||
| @@ -20,6 +20,7 @@ fi | ||||
|  | ||||
| # So daemons know where to recall us if needed | ||||
| export RC_SERVICE="$1" | ||||
| shift | ||||
|  | ||||
| # Compat | ||||
| export SVCNAME=${RC_SVCNAME} | ||||
| @@ -44,9 +45,49 @@ describe() | ||||
| 	done | ||||
| } | ||||
|  | ||||
| # Template start / stop functions | ||||
| start() | ||||
| { | ||||
| 	[ -n "${command}" ] || return 0 | ||||
| 	local _background= | ||||
| 	ebegin "Starting ${name:-${RC_SVCNAME}}" | ||||
| 	if yesno "${command_background}"; then  | ||||
| 		_background="--background --pidfile" | ||||
| 	fi | ||||
| 	if yesno "${start_inactive}"; then | ||||
| 		local _inactive=false | ||||
| 		service_inactive && _inactive=true | ||||
| 		mark_service_inactive | ||||
| 	fi | ||||
| 	start-stop-daemon --start \ | ||||
| 		--exec ${command} \ | ||||
| 		${procname:+--name} ${procname} \ | ||||
| 		${pidfile:+--pidfile} ${pidfile} \ | ||||
| 		${_background} ${start_stop_daemon_args} \ | ||||
| 		-- ${command_args} | ||||
| 	eend $? "Failed to start ${RC_SVCNAME}" && return 0 | ||||
| 	if yesno "${start_inactive}"; then | ||||
| 		if ! ${_inactive}; then | ||||
| 			mark_service_stopped | ||||
| 		fi | ||||
| 	fi | ||||
| 	return 1 | ||||
| } | ||||
|  | ||||
| stop() | ||||
| { | ||||
| 	[ -n "${command}" -o -n "${procname}" -o -n "${pidfile}" ] || return 0 | ||||
| 	ebegin "Stopping ${name:-${RC_SVCNAME}}" | ||||
| 	start-stop-daemon --stop \ | ||||
| 		${command:+--exec} ${command} \ | ||||
| 		${procname:+--name} ${procname} \ | ||||
| 		${pidfile:+--pidfile} ${pidfile} | ||||
| 	eend $? "Failed to stop ${RC_SVCNAME}" | ||||
| } | ||||
|  | ||||
| yesno ${RC_DEBUG} && set -x | ||||
|  | ||||
| _conf_d=${1%/*}/../conf.d | ||||
| _conf_d=${RC_SERVICE%/*}/../conf.d | ||||
| # If we're net.eth0 or openvpn.work then load net or openvpn config | ||||
| _c=${RC_SVCNAME%%.*} | ||||
| if [ -n "${_c}" -a "${_c}" != "${RC_SVCNAME}" ]; then | ||||
| @@ -73,8 +114,7 @@ unset _conf_d | ||||
| [ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}} | ||||
|  | ||||
| # Load our script | ||||
| . $1 | ||||
| shift | ||||
| . "${RC_SERVICE}" | ||||
|  | ||||
| for _d in ${required_dirs}; do | ||||
| 	if [ ! -d ${_d} ]; then | ||||
| @@ -92,58 +132,12 @@ for _f in ${required_files}; do | ||||
| done | ||||
| unset _f | ||||
|  | ||||
| # If we have a default command then supply a default start function | ||||
| if [ -n "${command}" ]; then | ||||
| 	if ! type start >/dev/null 2>&1; then | ||||
| 		start() { | ||||
| 			local _background= | ||||
| 			ebegin "Starting ${name:-${RC_SVCNAME}}" | ||||
| 			if yesno "${command_background}"; then  | ||||
| 				_background="--background --pidfile" | ||||
| 			fi | ||||
| 			if yesno "${start_inactive}"; then | ||||
| 				local _inactive=false | ||||
| 				service_inactive && _inactive=true | ||||
| 				mark_service_inactive | ||||
| 			fi | ||||
| 			start-stop-daemon --start \ | ||||
| 				--exec ${command} \ | ||||
| 				${procname:+--name} ${procname} \ | ||||
| 				${pidfile:+--pidfile} ${pidfile} \ | ||||
| 				${_background} ${start_stop_daemon_args} \ | ||||
| 				-- ${command_args} | ||||
| 			eend $? "Failed to start ${RC_SVCNAME}" && return 0 | ||||
| 			if yesno "${start_inactive}"; then | ||||
| 				if ! ${_inactive}; then | ||||
| 			   		mark_service_stopped | ||||
| 				fi | ||||
| 			fi | ||||
| 			return 1 | ||||
| 		} | ||||
| 	fi | ||||
| fi | ||||
|  | ||||
| # If we have a default command, procname or pidfile then supply a default stop  | ||||
| # function | ||||
| if [ -n "${command}" -o -n "${procname}" -o -n "${pidfile}" ]; then | ||||
| 	if ! type stop >/dev/null 2>&1; then | ||||
| 		stop() { | ||||
| 			ebegin "Stopping ${name:-${RC_SVCNAME}}" | ||||
| 			start-stop-daemon --stop \ | ||||
| 				${command:+--exec} ${command} \ | ||||
| 				${procname:+--name} ${procname} \ | ||||
| 				${pidfile:+--pidfile} ${pidfile} | ||||
| 			eend $? "Failed to stop ${RC_SVCNAME}" | ||||
| 		} | ||||
| 	fi | ||||
| fi | ||||
|  | ||||
| while [ -n "$1" ]; do | ||||
| 	# See if we have the required function and run it | ||||
| 	for _cmd in describe start stop ${extra_commands:-${opts}} \ | ||||
| 		${extra_started_commands}; do | ||||
| 		if [ "${_cmd}" = "$1" ]; then | ||||
| 			if type "$1" >/dev/null 2>&1; then | ||||
| 			if [ "$(command -v "$1")" = "$1" ]; then | ||||
| 				# If we're in the background, we may wish to | ||||
| 				# fake some commands. We do this so we can | ||||
| 				# "start" ourselves from inactive which then | ||||
| @@ -168,11 +162,11 @@ while [ -n "$1" ]; do | ||||
| 					fi | ||||
| 				done | ||||
| 				unset _cmd | ||||
| 				if type "$1"_pre >/dev/null 2>&1; then | ||||
| 				if [ "$(command -v "$1_pre")" = "$1_pre" ]; then | ||||
| 					"$1"_pre || exit $? | ||||
| 				fi | ||||
| 				"$1" || exit $? | ||||
| 				if type "$1"_post >/dev/null 2>&1; then | ||||
| 				if [ "$(command -v "$1_post")" = "$1_post" ]; then | ||||
| 					"$1"_post || exit $? | ||||
| 				fi | ||||
| 				shift | ||||
|   | ||||
| @@ -561,14 +561,13 @@ bool rc_service_daemons_crashed(const char *service) | ||||
| 			if ((fp = fopen(pidfile, "r"))) { | ||||
| 				if (fscanf(fp, "%d", &pid) == 1) | ||||
| 					retval = false; | ||||
| 				 | ||||
| 				fclose (fp); | ||||
| 			} | ||||
| 			free(pidfile); | ||||
| 			pidfile = NULL; | ||||
|  | ||||
| 			/* We have the pid, so no need to match on name */ | ||||
| 			free (name); | ||||
| 			free(name); | ||||
| 			name = NULL; | ||||
| 		} else { | ||||
| 			if (exec) { | ||||
|   | ||||
| @@ -655,6 +655,7 @@ static const char *const depdirs[] = | ||||
| 	RC_SVCDIR "/options", | ||||
| 	RC_SVCDIR "/exclusive", | ||||
| 	RC_SVCDIR "/scheduled", | ||||
| 	RC_SVCDIR "/tmp", | ||||
| 	NULL | ||||
| }; | ||||
|  | ||||
| @@ -847,7 +848,7 @@ bool rc_deptree_update(void) | ||||
| 		nosys[0] = 'n'; | ||||
| 		nosys[1] = 'o'; | ||||
| 		for (i = 0; i < len; i++) | ||||
| 			nosys[i + 2] = (char) tolower((int) sys[i]); | ||||
| 			nosys[i + 2] = (char)tolower((unsigned char)sys[i]); | ||||
| 		nosys[i + 2] = '\0'; | ||||
|  | ||||
| 		STAILQ_FOREACH_SAFE(depinfo, deptree, entries, depinfo_np) | ||||
|   | ||||
| @@ -139,6 +139,7 @@ static const struct option longopts[] = { | ||||
| static const char * const longopts_help[] = { | ||||
| 	"Extract the block device", | ||||
| 	"Mounts the filesytem from the mountpoint", | ||||
| 	"Show arguments needed to mount the entry", | ||||
| 	"Extract the options field", | ||||
| 	"Extract or query the pass number field", | ||||
| 	"List entries with matching file system type", | ||||
|   | ||||
| @@ -58,7 +58,7 @@ static int syslog_decode(char *name, CODE *codetab) | ||||
| { | ||||
| 	CODE *c; | ||||
|  | ||||
| 	if (isdigit((int) *name)) | ||||
| 	if (isdigit((unsigned char)*name)) | ||||
| 		return atoi(name); | ||||
|  | ||||
| 	for (c = codetab; c->c_name; c++) | ||||
| @@ -351,7 +351,7 @@ static int do_shell_var(int argc, char **argv) | ||||
| 			putchar(' '); | ||||
|  | ||||
| 		while (*p) { | ||||
| 			c = *p++; | ||||
| 			c = (unsigned char)*p++; | ||||
| 			if (! isalnum(c)) | ||||
| 				c = '_'; | ||||
| 			putchar(c); | ||||
|   | ||||
| @@ -103,7 +103,7 @@ static void write_log(int logfd, const char *buffer, size_t bytes) | ||||
| 			continue; | ||||
| 		} | ||||
|  | ||||
| 		if (! in_term || isalpha((int) *p)) | ||||
| 		if (! in_term || isalpha((unsigned char)*p)) | ||||
| 			in_escape = in_term = false; | ||||
| cont: | ||||
| 		p++; | ||||
|   | ||||
| @@ -93,8 +93,8 @@ char *rc_conf_value(const char *setting) | ||||
| 			TAILQ_FOREACH(s, rc_conf, entries) { | ||||
| 				p = s->value; | ||||
| 				while (p && *p && *p != '=') { | ||||
| 					if (isupper((int) *p)) | ||||
| 						*p = tolower((int) *p); | ||||
| 					if (isupper((unsigned char)*p)) | ||||
| 						*p = tolower((unsigned char)*p); | ||||
| 					p++; | ||||
| 				} | ||||
| 			} | ||||
| @@ -224,6 +224,7 @@ void env_config(void) | ||||
|  | ||||
| 	setenv("RC_LIBDIR", RC_LIBDIR, 1); | ||||
| 	setenv("RC_SVCDIR", RC_SVCDIR, 1); | ||||
| 	setenv("RC_TMPDIR", RC_SVCDIR "/tmp", 1); | ||||
| 	setenv("RC_BOOTLEVEL", RC_LEVEL_BOOT, 1); | ||||
| 	e = rc_runlevel_get(); | ||||
| 	setenv("RC_RUNLEVEL", e, 1); | ||||
|   | ||||
| @@ -122,14 +122,15 @@ int rc_waitpid(pid_t pid) | ||||
| { | ||||
| 	int status = 0; | ||||
| 	pid_t savedpid = pid; | ||||
| 	int retval = -1; | ||||
| 	int retval = EXIT_FAILURE; | ||||
|  | ||||
| 	errno = 0; | ||||
| 	while ((pid = waitpid(savedpid, &status, 0)) > 0) { | ||||
| 	do { | ||||
| 		pid = waitpid(savedpid, &status, 0); | ||||
| 		if (pid == -1 && errno != EINTR) | ||||
| 			return EXIT_FAILURE; | ||||
| 	} while (!WIFEXITED(status) && !WIFSIGNALED(status)); | ||||
| 	if (pid == savedpid) | ||||
| 		retval = WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE; | ||||
| 	} | ||||
|  | ||||
| 	return retval; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -53,6 +53,7 @@ static const struct option longopts[] = { | ||||
| static const char * const longopts_help[] = { | ||||
| 	"tests if the service exists or not", | ||||
| 	"list all available services", | ||||
| 	"resolve the service name to an init script", | ||||
| 	longopts_help_COMMON | ||||
| }; | ||||
| #include "_usage.c" | ||||
|   | ||||
| @@ -103,9 +103,13 @@ static void print_service(const char *service) | ||||
| 		snprintf(status, sizeof(status), "inactive "); | ||||
| 		color = ECOLOR_WARN; | ||||
| 	} else if (state & RC_SERVICE_STARTED) { | ||||
| 		if (test_crashed && rc_service_daemons_crashed(service)) | ||||
| 		errno = 0; | ||||
| 		if (test_crashed && | ||||
| 		    rc_service_daemons_crashed(service) && | ||||
| 		    errno != EACCES) | ||||
| 		{ | ||||
| 			snprintf(status, sizeof(status), " crashed "); | ||||
| 		else { | ||||
| 		} else { | ||||
| 			snprintf(status, sizeof(status), " started "); | ||||
| 			color = ECOLOR_GOOD; | ||||
| 		} | ||||
| @@ -149,6 +153,8 @@ static void print_services(const char *runlevel, RC_STRINGLIST *services) | ||||
| 	l = rc_deptree_depends(deptree, types, services, r ? r : runlevel, | ||||
| 			       RC_DEP_STRICT | RC_DEP_TRACE | RC_DEP_START); | ||||
| 	free(r); | ||||
| 	if (!l) | ||||
| 		return; | ||||
| 	TAILQ_FOREACH(s, l, entries) { | ||||
| 		TAILQ_FOREACH(t, services, entries) | ||||
| 			if (strcmp(t->value, s->value) == 0) | ||||
| @@ -185,7 +191,7 @@ static const char * const longopts_help[] = { | ||||
| int rc_status(int argc, char **argv) | ||||
| { | ||||
| 	RC_STRINGLIST *levels = NULL; | ||||
| 	RC_STRINGLIST *services; | ||||
| 	RC_STRINGLIST *services = NULL; | ||||
| 	RC_STRING *s, *l, *t; | ||||
| 	char *p; | ||||
| 	int opt; | ||||
| @@ -256,9 +262,10 @@ int rc_status(int argc, char **argv) | ||||
| 	} | ||||
|  | ||||
| 	/* Show unassigned running too */ | ||||
| 	if (argc < 2) { | ||||
| 	if (argc < 2 && | ||||
| 	    (services = rc_services_in_runlevel(NULL))) | ||||
| 	{ | ||||
| 		print_level("UNASSIGNED"); | ||||
| 		services = rc_services_in_runlevel(NULL); | ||||
| 		rc_stringlist_free(levels); | ||||
| 		levels = rc_runlevel_list(); | ||||
| 		TAILQ_FOREACH_SAFE(s, services, entries, t) { | ||||
|   | ||||
							
								
								
									
										117
									
								
								src/rc/rc.c
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								src/rc/rc.c
									
									
									
									
									
								
							| @@ -277,13 +277,53 @@ static void mark_interactive(void) | ||||
| 		fclose(fp); | ||||
| } | ||||
|  | ||||
| static void sulogin(bool cont) | ||||
| static void run_program(const char *prog) | ||||
| { | ||||
| 	int status = 0; | ||||
| 	struct sigaction sa; | ||||
| 	sigset_t full; | ||||
| 	sigset_t old; | ||||
| 	pid_t pid; | ||||
|  | ||||
| 	/* We need to block signals until we have forked */ | ||||
| 	memset(&sa, 0, sizeof(sa)); | ||||
| 	sa.sa_handler = SIG_DFL; | ||||
| 	sigemptyset(&sa.sa_mask); | ||||
| 	sigfillset(&full); | ||||
| 	sigprocmask(SIG_SETMASK, &full, &old); | ||||
| 	pid = fork(); | ||||
|  | ||||
| 	if (pid == -1) | ||||
| 		eerrorx("%s: fork: %s", applet, strerror(errno)); | ||||
| 	if (pid == 0) { | ||||
| 		/* Restore default handlers */ | ||||
| 		sigaction(SIGCHLD, &sa, NULL); | ||||
| 		sigaction(SIGHUP, &sa, NULL); | ||||
| 		sigaction(SIGINT, &sa, NULL); | ||||
| 		sigaction(SIGQUIT, &sa, NULL); | ||||
| 		sigaction(SIGTERM, &sa, NULL); | ||||
| 		sigaction(SIGUSR1, &sa, NULL); | ||||
| 		sigaction(SIGWINCH, &sa, NULL); | ||||
|  | ||||
| 		/* Unmask signals */ | ||||
| 		sigprocmask(SIG_SETMASK, &old, NULL); | ||||
|  | ||||
| 		if (termios_orig) | ||||
| 			tcsetattr(fileno(stdin), TCSANOW, termios_orig); | ||||
|  | ||||
| 		execl(prog, prog, (char *) NULL); | ||||
| 		eerror("%s: unable to exec `%s': %s", applet, prog, | ||||
| 		       strerror(errno)); | ||||
| 		_exit(EXIT_FAILURE); | ||||
| 	} | ||||
|  | ||||
| 	/* Unmask signals and wait for child */ | ||||
| 	sigprocmask(SIG_SETMASK, &old, NULL); | ||||
| 	if (rc_waitpid(pid) == -1) | ||||
| 		eerrorx("%s: failed to exec `%s'", applet, prog); | ||||
| } | ||||
|  | ||||
| static void sulogin(bool cont) | ||||
| { | ||||
| #ifdef __linux__ | ||||
| 	const char *sys = rc_sys(); | ||||
|  | ||||
| @@ -306,47 +346,11 @@ static void sulogin(bool cont) | ||||
| #endif | ||||
| 	} | ||||
|  | ||||
| 	/* We need to block signals until we have forked */ | ||||
| 	memset(&sa, 0, sizeof(sa)); | ||||
| 	sa.sa_handler = SIG_DFL; | ||||
| 	sigemptyset(&sa.sa_mask); | ||||
| 	sigfillset(&full); | ||||
| 	sigprocmask(SIG_SETMASK, &full, &old); | ||||
| 	pid = vfork(); | ||||
|  | ||||
| 	if (pid == -1) | ||||
| 		eerrorx("%s: fork: %s", applet, strerror(errno)); | ||||
| 	if (pid == 0) { | ||||
| 		/* Restore default handlers */ | ||||
| 		sigaction(SIGCHLD, &sa, NULL); | ||||
| 		sigaction(SIGHUP, &sa, NULL); | ||||
| 		sigaction(SIGINT, &sa, NULL); | ||||
| 		sigaction(SIGQUIT, &sa, NULL); | ||||
| 		sigaction(SIGTERM, &sa, NULL); | ||||
| 		sigaction(SIGUSR1, &sa, NULL); | ||||
| 		sigaction(SIGWINCH, &sa, NULL); | ||||
|  | ||||
| 		/* Unmask signals */ | ||||
| 		sigprocmask(SIG_SETMASK, &old, NULL); | ||||
|  | ||||
| 		if (termios_orig) | ||||
| 			tcsetattr(fileno(stdin), TCSANOW, termios_orig); | ||||
|  | ||||
| #ifdef __linux__ | ||||
| 		execl(SULOGIN, SULOGIN, (char *) NULL); | ||||
| 		eerror("%s: unable to exec `%s': %s", applet, SULOGIN, | ||||
| 		       strerror(errno)); | ||||
| 	run_program(SULOGIN); | ||||
| #else | ||||
| 		execl("/bin/sh", "/bin/sh", (char *) NULL); | ||||
| 		eerror("%s: unable to exec `/bin/sh': %s", applet, | ||||
| 		       strerror(errno)); | ||||
| 	run_program("/bin/sh"); | ||||
| #endif | ||||
| 		_exit(EXIT_FAILURE); | ||||
| 	} | ||||
|  | ||||
| 	/* Unmask signals and wait for child */ | ||||
| 	sigprocmask(SIG_SETMASK, &old, NULL); | ||||
| 	waitpid(pid, &status, 0); | ||||
| } | ||||
|  | ||||
| static void single_user(void) | ||||
| @@ -449,7 +453,7 @@ static void handle_signal(int sig) | ||||
| 					eerror("waitpid: %s", strerror(errno)); | ||||
| 				return; | ||||
| 			} | ||||
| 		} while (! WIFEXITED(status) && ! WIFSIGNALED(status)); | ||||
| 		} while (!WIFEXITED(status) && !WIFSIGNALED(status)); | ||||
|  | ||||
| 		/* Remove that pid from our list */ | ||||
| 		if (pid > 0) | ||||
| @@ -511,31 +515,6 @@ static void handle_signal(int sig) | ||||
| 	errno = serrno; | ||||
| } | ||||
|  | ||||
| static void run_script(const char *script) | ||||
| { | ||||
| 	int status = 0; | ||||
| 	pid_t pid = vfork(); | ||||
| 	pid_t wpid; | ||||
|  | ||||
| 	if (pid < 0) | ||||
| 		eerrorx("%s: vfork: %s", applet, strerror(errno)); | ||||
| 	else if (pid == 0) { | ||||
| 		execl(script, script, (char *) NULL); | ||||
| 		eerror("%s: unable to exec `%s': %s", | ||||
| 			script, applet, strerror(errno)); | ||||
| 		_exit(EXIT_FAILURE); | ||||
| 	} | ||||
|  | ||||
| 	do { | ||||
| 		wpid = waitpid(pid, &status, 0); | ||||
| 		if (wpid < 1) | ||||
| 			eerror("waitpid: %s", strerror(errno)); | ||||
| 	} while (! WIFEXITED(status) && ! WIFSIGNALED(status)); | ||||
|  | ||||
| 	if (! WIFEXITED(status) || ! WEXITSTATUS(status) == 0) | ||||
| 		eerrorx("%s: failed to exec `%s'", applet, script); | ||||
| } | ||||
|  | ||||
| static void do_coldplug(void) | ||||
| { | ||||
| 	size_t l; | ||||
| @@ -582,7 +561,7 @@ static void do_coldplug(void) | ||||
| 			    strncmp(d->d_name, "ums", 3) == 0) | ||||
| 			{ | ||||
| 				p = d->d_name + 3; | ||||
| 				if (p && isdigit((int) *p)) { | ||||
| 				if (p && isdigit((unsigned char)*p)) { | ||||
| 					l = strlen("moused.") + strlen(d->d_name) + 1; | ||||
| 					service = xmalloc(sizeof(char) * l); | ||||
| 					snprintf (service, l, "moused.%s", d->d_name); | ||||
| @@ -660,7 +639,7 @@ static void do_newlevel(const char *newlevel) | ||||
| 		 * This should just setup the console to use the correct | ||||
| 		 * font. Maybe it should setup the keyboard too? */ | ||||
| 		if (exists(INITEARLYSH)) | ||||
| 			run_script(INITEARLYSH); | ||||
| 			run_program(INITEARLYSH); | ||||
|  | ||||
| 		uname(&uts); | ||||
| 		printf("\n   %sOpenRC %s" VERSION "%s is starting up %s", | ||||
| @@ -688,7 +667,7 @@ static void do_newlevel(const char *newlevel) | ||||
| 		setenv("RC_RUNLEVEL", newlevel, 1); | ||||
| 		rc_plugin_run(RC_HOOK_RUNLEVEL_START_IN, newlevel); | ||||
| 		hook_out = RC_HOOK_RUNLEVEL_START_OUT; | ||||
| 		run_script(INITSH); | ||||
| 		run_program(INITSH); | ||||
|  | ||||
| #ifdef __linux__ | ||||
| 		/* If we requested a runlevel, save it now */ | ||||
|   | ||||
| @@ -156,7 +156,7 @@ static void handle_signal(int sig) | ||||
| 			if (write(signal_pipe[1], &sig, sizeof(sig)) == -1) | ||||
| 				eerror("%s: send: %s", service, strerror(errno)); | ||||
| 		} else | ||||
| 			rc_waitpid (-1); | ||||
| 			rc_waitpid(-1); | ||||
| 		break; | ||||
|  | ||||
| 	case SIGWINCH: | ||||
| @@ -559,8 +559,10 @@ static RC_SERVICE svc_status(void) | ||||
| 		snprintf(status, sizeof(status), "inactive"); | ||||
| 		e = &ewarn; | ||||
| 	} else if (state & RC_SERVICE_STARTED) { | ||||
| 		errno = 0; | ||||
| 		if (_rc_can_find_pids() && | ||||
| 		    rc_service_daemons_crashed(service)) | ||||
| 		    rc_service_daemons_crashed(service) && | ||||
| 		    errno != EACCES) | ||||
| 		{ | ||||
| 			snprintf(status, sizeof(status), "crashed"); | ||||
| 			e = &eerror; | ||||
| @@ -738,12 +740,20 @@ static void svc_start(bool deps) | ||||
| 				runlevel, depoptions); | ||||
|  | ||||
| 		if (! rc_runlevel_starting() && use_services) | ||||
| 			TAILQ_FOREACH(svc, use_services, entries) | ||||
| 				if (rc_service_state(svc->value) & RC_SERVICE_STOPPED) { | ||||
| 			TAILQ_FOREACH(svc, use_services, entries) { | ||||
| 				state = rc_service_state(svc->value); | ||||
| 				/* Don't stop failed services again. | ||||
| 				 * If you remove this check, ensure that the | ||||
| 				 * exclusive file isn't created. */ | ||||
| 				if (state & RC_SERVICE_FAILED && | ||||
| 				    rc_runlevel_starting()) | ||||
| 					continue; | ||||
| 				if (state & RC_SERVICE_STOPPED) { | ||||
| 					pid_t pid = service_start(svc->value); | ||||
| 					if (! rc_conf_yesno("rc_parallel")) | ||||
| 						rc_waitpid(pid); | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 		/* Now wait for them to start */ | ||||
| 		services = rc_deptree_depends(deptree, types_nua, applet_list, | ||||
| @@ -753,28 +763,29 @@ static void svc_start(bool deps) | ||||
| 			/* We use tmplist to hold our scheduled by list */ | ||||
| 			tmplist = NULL; | ||||
| 			TAILQ_FOREACH(svc, services, entries) { | ||||
| 				RC_SERVICE svcs = rc_service_state(svc->value); | ||||
| 				if (svcs & RC_SERVICE_STARTED) | ||||
| 				state = rc_service_state(svc->value); | ||||
| 				if (state & RC_SERVICE_STARTED) | ||||
| 					continue; | ||||
|  | ||||
| 				/* Don't wait for services which went inactive but are now in | ||||
| 				 * starting state which we are after */ | ||||
| 				if (svcs & RC_SERVICE_STARTING && | ||||
| 				    svcs & RC_SERVICE_WASINACTIVE) | ||||
| 				if (state & RC_SERVICE_STARTING && | ||||
| 				    state & RC_SERVICE_WASINACTIVE) | ||||
| 				{ | ||||
| 					if (!in_list(need_services, svc->value) && | ||||
| 					    !in_list(use_services, svc->value)) | ||||
| 						continue; | ||||
| 				} | ||||
|  | ||||
| 				if (! svc_wait(svc->value)) | ||||
| 				if (!svc_wait(svc->value)) | ||||
| 					eerror ("%s: timed out waiting for %s", | ||||
| 						applet, svc->value); | ||||
| 				if ((svcs = rc_service_state(svc->value)) & RC_SERVICE_STARTED) | ||||
| 				state = rc_service_state(svc->value); | ||||
| 				if (state & RC_SERVICE_STARTED) | ||||
| 					continue; | ||||
| 				if (in_list(need_services, svc->value)) { | ||||
| 					if (svcs & RC_SERVICE_INACTIVE || | ||||
| 					    svcs & RC_SERVICE_WASINACTIVE) | ||||
| 					if (state & RC_SERVICE_INACTIVE || | ||||
| 					    state & RC_SERVICE_WASINACTIVE) | ||||
| 					{ | ||||
| 						if (! tmplist) | ||||
| 							tmplist = rc_stringlist_new(); | ||||
| @@ -937,14 +948,20 @@ static void svc_stop(bool deps) | ||||
| 					      runlevel, depoptions); | ||||
| 		if (services) { | ||||
| 			TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) { | ||||
| 				RC_SERVICE svcs = rc_service_state(svc->value); | ||||
| 				if (svcs & RC_SERVICE_STARTED || | ||||
| 				    svcs & RC_SERVICE_INACTIVE) | ||||
| 				state = rc_service_state(svc->value); | ||||
| 				/* Don't stop failed services again. | ||||
| 				 * If you remove this check, ensure that the | ||||
| 				 * exclusive file isn't created. */ | ||||
| 				if (state & RC_SERVICE_FAILED && | ||||
| 				    rc_runlevel_stopping()) | ||||
| 					continue; | ||||
| 				if (state & RC_SERVICE_STARTED || | ||||
| 				    state & RC_SERVICE_INACTIVE) | ||||
| 				{ | ||||
| 					svc_wait(svc->value); | ||||
| 					svcs = rc_service_state(svc->value); | ||||
| 					if (svcs & RC_SERVICE_STARTED || | ||||
| 					    svcs & RC_SERVICE_INACTIVE) | ||||
| 					state = rc_service_state(svc->value); | ||||
| 					if (state & RC_SERVICE_STARTED || | ||||
| 					    state & RC_SERVICE_INACTIVE) | ||||
| 					{ | ||||
| 						pid_t pid = service_stop(svc->value); | ||||
| 						if (! rc_conf_yesno("rc_parallel")) | ||||
| @@ -963,8 +980,6 @@ static void svc_stop(bool deps) | ||||
| 			TAILQ_FOREACH(svc, tmplist, entries) { | ||||
| 				if (rc_service_state(svc->value) & RC_SERVICE_STOPPED) | ||||
| 					continue; | ||||
|  | ||||
| 				/* We used to loop 3 times here - maybe re-do this if needed */ | ||||
| 				svc_wait(svc->value); | ||||
| 				if (! (rc_service_state(svc->value) & RC_SERVICE_STOPPED)) { | ||||
| 					if (rc_runlevel_stopping()) { | ||||
| @@ -977,7 +992,6 @@ static void svc_stop(bool deps) | ||||
| 							continue; | ||||
| 						rc_service_mark(service, RC_SERVICE_FAILED); | ||||
| 					} | ||||
|  | ||||
| 					eerrorx("ERROR: cannot stop %s as %s is still up", | ||||
| 							applet, svc->value); | ||||
| 				} | ||||
|   | ||||
| @@ -190,7 +190,7 @@ static SCHEDULEITEM *parse_schedule_item(const char *string) | ||||
| 	item->gotoitem = NULL; | ||||
| 	if (strcmp(string,"forever") == 0) | ||||
| 		item->type = SC_FOREVER; | ||||
| 	else if (isdigit((int) string[0])) { | ||||
| 	else if (isdigit((unsigned char)string[0])) { | ||||
| 		item->type = SC_TIMEOUT; | ||||
| 		errno = 0; | ||||
| 		if (sscanf(string, "%d", &item->value) != 1) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user