diff options
author | Roy Marples <roy@marples.name> | 2008-02-19 14:15:53 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-02-19 14:15:53 +0000 |
commit | 0364bb2c84bff631e0f765254fc6bf3353950128 (patch) | |
tree | 532aa8d419a4647f4ee5134256c75e228b06278e /src/rc | |
parent | f95e0b2c3e0192b44d6ac792f40a61a34f8c8b13 (diff) |
Add the nojail keyword which excludes services marked as such from the dependency tree when in a jail, #bug 22
Diffstat (limited to 'src/rc')
-rw-r--r-- | src/rc/rc-misc.c | 30 |
1 files changed, 2 insertions, 28 deletions
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) { |