Compare commits
	
		
			14 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					fe86e7691d | ||
| 
						 | 
					038cea416c | ||
| 
						 | 
					e2bd550d13 | ||
| 
						 | 
					ac49814607 | ||
| 
						 | 
					09fc8fe09c | ||
| 
						 | 
					3a2774732a | ||
| 
						 | 
					dec0722c30 | ||
| 
						 | 
					949daeb68b | ||
| 
						 | 
					fbab2affd2 | ||
| 
						 | 
					2824905935 | ||
| 
						 | 
					60eadd5fa2 | ||
| 
						 | 
					2a203b9b6e | ||
| 
						 | 
					a769ea1b92 | ||
| 
						 | 
					6f564b59cc | 
							
								
								
									
										122
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										122
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,3 +1,110 @@
 | 
				
			|||||||
 | 
					commit 038cea416c0a4cda83872733ab660cf0bb2b5eaf
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ignore sigchld when shutting down the supervised process
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    We need to do this to skip the zombie state for the child process since
 | 
				
			||||||
 | 
					    we are not easily able to wait() for it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit e2bd550d13d23ce132650d7e3dc36dc512bf048e
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    typo fix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit ac498146071636a3fbda4fb48ff64102c244415d
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    typo fix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 09fc8fe09c01a347666de66fb11e759de371a873
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    supervise-daemon: code cleanup
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Clean up the process for killing an active supervisor when stopping.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 3a2774732aa629083bc6395c5c7a8a3040e64b60
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    initialize the stop schedule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit dec0722c30e41480d300549a69d3672c38e0c15d
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    rc-schedules.c: pass the correct pid to rc_find_pids
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    This is for #163.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 949daeb68b2a39fa1e64f2eb3fa72579f98df09e
 | 
				
			||||||
 | 
					Author: Jason Zaman <jason@perfinion.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    selinux: fix const qualifier warning
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    rc-selinux.c: In function ‘selinux_setup’:
 | 
				
			||||||
 | 
					    rc-selinux.c:361:9: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 | 
				
			||||||
 | 
					      curr_t = context_type_get(curr_con);
 | 
				
			||||||
 | 
					             ^
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit fbab2affd2d5309ed4b5416e0e239902d77b4232
 | 
				
			||||||
 | 
					Author: Jason Zaman <jason@perfinion.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    selinux: use openrc contexts path to get contexts
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    The minimum requirement for libselinux is now >=2.6
 | 
				
			||||||
 | 
					    The refpolicy and the gentoo policy contain the
 | 
				
			||||||
 | 
					    contexts since version 2.20170204-r4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 28249059356d8b611a46c5493574abe9805ab48b
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    version 0.31.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 60eadd5fa2ba2675caab4f977b8627bc07e39e8e
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Update ChangeLog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 2a203b9b6e91e4ed140750eb9223012035870864
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    sysfs: fix cgroup hybrid mode
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    In hybrid mode, we should not try to mount cgroup2 if it is not
 | 
				
			||||||
 | 
					    available in the kernel.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    This fixes #164.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit a769ea1b92f47254edf11458d2c8b79d3819e0e6
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cgroup2_find_path: use legacy mode if cgroup2 is not in the kernel
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    This is related to #164.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit 6f564b59cc15e688b2fa0758fa9797632e0751d7
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    version 0.31.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commit e312e569970c74cf52e255da67034391b68dafac
 | 
				
			||||||
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Update ChangeLog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
commit 2f60a959b442866b0e879d83f2732c4fa3ed3f7d
 | 
					commit 2f60a959b442866b0e879d83f2732c4fa3ed3f7d
 | 
				
			||||||
Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
					Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
					Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			||||||
@@ -1421,18 +1528,3 @@ Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
				
			|||||||
    now have a request to enable it.
 | 
					    now have a request to enable it.
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    This fixes #24.
 | 
					    This fixes #24.
 | 
				
			||||||
 | 
					 | 
				
			||||||
commit c146b966913ae80652e3be925d3aba60ed82f14d
 | 
					 | 
				
			||||||
Author: William Hubbs <w.d.hubbs@gmail.com>
 | 
					 | 
				
			||||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Add command_progress variable
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    If this is set to yes, 1, true, or on, start-stop-daemon will display a
 | 
					 | 
				
			||||||
    progress meter while waiting for a daemon to stop.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
commit 6cabaf274defa11773094a2c85b3d0a9f0bd9b08
 | 
					 | 
				
			||||||
Author: Doug Freed <dwfreed@mtu.edu>
 | 
					 | 
				
			||||||
Commit: Doug Freed <dwfreed@mtu.edu>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    rc-misc: allow EINFO_VERBOSE through too
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,3 @@
 | 
				
			|||||||
NAME=		openrc
 | 
					NAME=		openrc
 | 
				
			||||||
VERSION=	0.31
 | 
					VERSION=	0.31.2
 | 
				
			||||||
PKG=		${NAME}-${VERSION}
 | 
					PKG=		${NAME}-${VERSION}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,6 +150,16 @@ cgroup1_controllers()
 | 
				
			|||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cgroup2_base()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						local base
 | 
				
			||||||
 | 
						base="$(cgroup2_find_path)"
 | 
				
			||||||
 | 
						mkdir -p "${base}"
 | 
				
			||||||
 | 
						mount -t cgroup2 none -o "${sysfs_opts},nsdelegate" "${base}" 2> /dev/null ||
 | 
				
			||||||
 | 
							mount -t cgroup2 none -o "${sysfs_opts}" "${base}"
 | 
				
			||||||
 | 
						return 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cgroup2_controllers()
 | 
					cgroup2_controllers()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	local active cgroup_path x y
 | 
						local active cgroup_path x y
 | 
				
			||||||
@@ -169,13 +179,12 @@ cgroup2_controllers()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cgroups_hybrid()
 | 
					cgroups_hybrid()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	grep -qw cgroup /proc/filesystems &&
 | 
						grep -qw cgroup /proc/filesystems || return 0
 | 
				
			||||||
		grep -qw cgroup2 /proc/filesystems ||
 | 
					 | 
				
			||||||
		return 0
 | 
					 | 
				
			||||||
	cgroup1_base
 | 
						cgroup1_base
 | 
				
			||||||
	mkdir /sys/fs/cgroup/unified
 | 
						if grep -qw cgroup2 /proc/filesystems; then
 | 
				
			||||||
	mount -t cgroup2 none -o "${sysfs_opts},nsdelegate" /sys/fs/cgroup/unified
 | 
							cgroup2_base
 | 
				
			||||||
		cgroup2_controllers
 | 
							cgroup2_controllers
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
	cgroup1_controllers
 | 
						cgroup1_controllers
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -190,8 +199,8 @@ cgroups_legacy()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cgroups_unified()
 | 
					cgroups_unified()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	grep -qw cgroup2 /proc/filesystems || return 0
 | 
						cgroup2_base
 | 
				
			||||||
	mount -t cgroup2 none -o "${sysfs_opts},nsdelegate" /sys/fs/cgroup
 | 
						cgroup2_controllers
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,10 +146,12 @@ cgroup_set_limits()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cgroup2_find_path()
 | 
					cgroup2_find_path()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if grep -qw cgroup2 /proc/filesystems; then
 | 
				
			||||||
		case "${rc_cgroup_mode:-hybrid}" in
 | 
							case "${rc_cgroup_mode:-hybrid}" in
 | 
				
			||||||
			hybrid) printf "/sys/fs/cgroup/unified" ;;
 | 
								hybrid) printf "/sys/fs/cgroup/unified" ;;
 | 
				
			||||||
			unified) printf "/sys/fs/cgroup" ;;
 | 
								unified) printf "/sys/fs/cgroup" ;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -180,7 +182,7 @@ cgroup2_set_limits()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	local cgroup_path
 | 
						local cgroup_path
 | 
				
			||||||
	cgroup_path="$(cgroup2_find_path)"
 | 
						cgroup_path="$(cgroup2_find_path)"
 | 
				
			||||||
	[ -z "${cgroup_path}" ] && return 0
 | 
						[ -d "${cgroup_path}" ] || return 0
 | 
				
			||||||
	rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
 | 
						rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
 | 
				
			||||||
	local OIFS="$IFS"
 | 
						local OIFS="$IFS"
 | 
				
			||||||
	IFS="
 | 
						IFS="
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,11 +56,6 @@ typedef struct scheduleitem {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static TAILQ_HEAD(, scheduleitem) schedule;
 | 
					static TAILQ_HEAD(, scheduleitem) schedule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void initialize_schedulelist(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	TAILQ_INIT(&schedule);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void free_schedulelist(void)
 | 
					void free_schedulelist(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
 | 
						SCHEDULEITEM *s1 = TAILQ_FIRST(&schedule);
 | 
				
			||||||
@@ -186,6 +181,7 @@ void parse_schedule(const char *applet, const char *string, int timeout)
 | 
				
			|||||||
	size_t len;
 | 
						size_t len;
 | 
				
			||||||
	SCHEDULEITEM *item;
 | 
						SCHEDULEITEM *item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						TAILQ_INIT(&schedule);
 | 
				
			||||||
	if (string)
 | 
						if (string)
 | 
				
			||||||
		for (slash = string; *slash; slash++)
 | 
							for (slash = string; *slash; slash++)
 | 
				
			||||||
			if (*slash == '/')
 | 
								if (*slash == '/')
 | 
				
			||||||
@@ -261,10 +257,10 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
 | 
				
			|||||||
	bool killed;
 | 
						bool killed;
 | 
				
			||||||
	int nkilled = 0;
 | 
						int nkilled = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (pid)
 | 
						if (pid > 0)
 | 
				
			||||||
		pids = rc_find_pids(NULL, NULL, 0, pid);
 | 
							pids = rc_find_pids(NULL, NULL, 0, pid);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		pids = rc_find_pids(exec, argv, uid, pid);
 | 
							pids = rc_find_pids(exec, argv, uid, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!pids)
 | 
						if (!pids)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,6 @@
 | 
				
			|||||||
#ifndef __RC_SCHEDULES_H
 | 
					#ifndef __RC_SCHEDULES_H
 | 
				
			||||||
#define __RC_SCHEDULES_H
 | 
					#define __RC_SCHEDULES_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void initialize_schedulelist(void);
 | 
					 | 
				
			||||||
void free_schedulelist(void);
 | 
					void free_schedulelist(void);
 | 
				
			||||||
int parse_signal(const char *applet, const char *sig);
 | 
					int parse_signal(const char *applet, const char *sig);
 | 
				
			||||||
void parse_schedule(const char *applet, const char *string, int timeout);
 | 
					void parse_schedule(const char *applet, const char *string, int timeout);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,6 @@
 | 
				
			|||||||
#include "rc-selinux.h"
 | 
					#include "rc-selinux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* the context files for selinux */
 | 
					/* the context files for selinux */
 | 
				
			||||||
#define RUN_INIT_FILE "run_init_type"
 | 
					 | 
				
			||||||
#define INITRC_FILE "initrc_context"
 | 
					#define INITRC_FILE "initrc_context"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef HAVE_AUDIT
 | 
					#ifdef HAVE_AUDIT
 | 
				
			||||||
@@ -299,6 +298,26 @@ static int read_context_file(const char *filename, char **context)
 | 
				
			|||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int read_run_init_context(char **context)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int ret = -1;
 | 
				
			||||||
 | 
						RC_STRINGLIST *list;
 | 
				
			||||||
 | 
						char *value = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						list = rc_config_list(selinux_openrc_contexts_path());
 | 
				
			||||||
 | 
						if (list == NULL)
 | 
				
			||||||
 | 
							return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						value = rc_config_value(list, "run_init");
 | 
				
			||||||
 | 
						if (value != NULL && strlen(value) > 0) {
 | 
				
			||||||
 | 
							*context = xstrdup(value);
 | 
				
			||||||
 | 
							ret = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rc_stringlist_free(list);
 | 
				
			||||||
 | 
						return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void selinux_setup(char **argv)
 | 
					void selinux_setup(char **argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char *new_context = NULL;
 | 
						char *new_context = NULL;
 | 
				
			||||||
@@ -312,7 +331,7 @@ void selinux_setup(char **argv)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (read_context_file(RUN_INIT_FILE, &run_init_t) != 0) {
 | 
						if (read_run_init_context(&run_init_t) != 0) {
 | 
				
			||||||
		/* assume a reasonable default, rather than bailing out */
 | 
							/* assume a reasonable default, rather than bailing out */
 | 
				
			||||||
		run_init_t = xstrdup("run_init_t");
 | 
							run_init_t = xstrdup("run_init_t");
 | 
				
			||||||
		ewarn("Assuming SELinux run_init type is %s", run_init_t);
 | 
							ewarn("Assuming SELinux run_init type is %s", run_init_t);
 | 
				
			||||||
@@ -339,14 +358,13 @@ void selinux_setup(char **argv)
 | 
				
			|||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	curr_t = context_type_get(curr_con);
 | 
						curr_t = xstrdup(context_type_get(curr_con));
 | 
				
			||||||
	if (!curr_t) {
 | 
						if (!curr_t) {
 | 
				
			||||||
		context_free(curr_con);
 | 
							context_free(curr_con);
 | 
				
			||||||
		free(curr_context);
 | 
							free(curr_context);
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	curr_t = xstrdup(curr_t);
 | 
					 | 
				
			||||||
	/* dont need them anymore so free() now */
 | 
						/* dont need them anymore so free() now */
 | 
				
			||||||
	context_free(curr_con);
 | 
						context_free(curr_con);
 | 
				
			||||||
	free(curr_context);
 | 
						free(curr_context);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -432,6 +432,7 @@ int main(int argc, char **argv)
 | 
				
			|||||||
	int respawn_period = 5;
 | 
						int respawn_period = 5;
 | 
				
			||||||
	time_t respawn_now= 0;
 | 
						time_t respawn_now= 0;
 | 
				
			||||||
	time_t first_spawn= 0;
 | 
						time_t first_spawn= 0;
 | 
				
			||||||
 | 
						struct timespec ts;
 | 
				
			||||||
	struct passwd *pw;
 | 
						struct passwd *pw;
 | 
				
			||||||
	struct group *gr;
 | 
						struct group *gr;
 | 
				
			||||||
	FILE *fp;
 | 
						FILE *fp;
 | 
				
			||||||
@@ -658,17 +659,19 @@ int main(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (stop) {
 | 
						if (stop) {
 | 
				
			||||||
		pid = get_pid(applet, pidfile);
 | 
							pid = get_pid(applet, pidfile);
 | 
				
			||||||
		if (pid == -1)
 | 
							if (pid != -1) {
 | 
				
			||||||
			i = pid;
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			i = kill(pid, SIGTERM);
 | 
								i = kill(pid, SIGTERM);
 | 
				
			||||||
			if (i != 0)
 | 
								if (i != 0)
 | 
				
			||||||
				/* We failed to send the signal */
 | 
									/* We failed to send the signal */
 | 
				
			||||||
				exit(EXIT_FAILURE);
 | 
									exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* wait for the supervisor to go down */
 | 
								/* wait for the supervisor to go down */
 | 
				
			||||||
		while (kill(pid, 0) == 0)
 | 
								while (kill(pid, 0) == 0) {
 | 
				
			||||||
			sleep(1);
 | 
									ts.tv_sec = 0;
 | 
				
			||||||
 | 
									ts.tv_nsec = 1;
 | 
				
			||||||
 | 
									nanosleep(&ts, NULL);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Even if we have not actually killed anything, we should
 | 
							/* Even if we have not actually killed anything, we should
 | 
				
			||||||
		 * remove information about it as it may have unexpectedly
 | 
							 * remove information about it as it may have unexpectedly
 | 
				
			||||||
@@ -750,6 +753,7 @@ int main(int argc, char **argv)
 | 
				
			|||||||
		while (!exiting) {
 | 
							while (!exiting) {
 | 
				
			||||||
			wait(&i);
 | 
								wait(&i);
 | 
				
			||||||
			if (exiting) {
 | 
								if (exiting) {
 | 
				
			||||||
 | 
									signal_setup(SIGCHLD, SIG_IGN);
 | 
				
			||||||
				syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
 | 
									syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
 | 
				
			||||||
				nkilled = run_stop_schedule(applet, exec, NULL, child_pid,
 | 
									nkilled = run_stop_schedule(applet, exec, NULL, child_pid,
 | 
				
			||||||
						0, false, false, true);
 | 
											0, false, false, true);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user