From 0364bb2c84bff631e0f765254fc6bf3353950128 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 19 Feb 2008 14:15:53 +0000 Subject: Add the nojail keyword which excludes services marked as such from the dependency tree when in a jail, #bug 22 --- src/rc/rc-misc.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'src/rc/rc-misc.c') diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index e56f8006..1c340dd6 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -276,9 +276,7 @@ char **env_config (void) char **env = NULL; char *line; size_t l; -#ifdef __linux__ - char sys[6]; -#endif + const char *sys = rc_sys (); struct utsname uts; FILE *fp; char buffer[PATH_MAX]; @@ -323,29 +321,7 @@ char **env_config (void) } else rc_strlist_add (&env, "RC_DEFAULTLEVEL=" RC_LEVEL_DEFAULT); - -#ifdef __linux__ - /* Linux can run some funky stuff like Xen, VServer, UML, etc - We store this special system in RC_SYS so our scripts run fast */ - memset (sys, 0, sizeof (sys)); - - if (exists ("/proc/xen")) { - if ((fp = fopen ("/proc/xen/capabilities", "r"))) { - fclose (fp); - if (file_regex ("/proc/xen/capabilities", "control_d")) - snprintf (sys, sizeof (sys), "XEN0"); - } - if (! sys[0]) - snprintf (sys, sizeof (sys), "XENU"); - } else if (file_regex ("/proc/cpuinfo", "UML")) { - snprintf (sys, sizeof (sys), "UML"); - } else if (file_regex ("/proc/self/status", - "(s_context|VxID|envID):[[:space:]]*[1-9]")) - { - snprintf (sys, sizeof (sys), "VPS"); - } - - if (sys[0]) { + if (sys) { l = strlen ("RC_SYS=") + strlen (sys) + 2; line = xmalloc (sizeof (char) * l); snprintf (line, l, "RC_SYS=%s", sys); @@ -353,8 +329,6 @@ char **env_config (void) free (line); } -#endif - /* Some scripts may need to take a different code path if Linux/FreeBSD, etc To save on calling uname, we store it in an environment variable */ if (uname (&uts) == 0) { -- cgit v1.2.3