Punt the RC_TTY variable

This commit is contained in:
Roy Marples 2007-07-12 09:48:44 +00:00
parent 685aa53dce
commit 06e687598d

View File

@ -578,7 +578,9 @@ char **rc_config_env (char **env)
char *p;
char **config;
char *e;
#ifdef __linux__
char sys[6];
#endif
struct utsname uts;
bool has_net_fs_list = false;
FILE *fp;
@ -655,25 +657,12 @@ char **rc_config_env (char **env)
} else
env = rc_strlist_add (env, "RC_DEFAULTLEVEL=" RC_LEVEL_DEFAULT);
/* Store the name of the tty that stdout is connected to
* We do this so our init scripts can call eflush without any knowledge
* of our fd's */
if (isatty (fileno (stdout))) {
if ((p = rc_xstrdup (ttyname (fileno (stdout))))) {
i = strlen ("RC_TTY=") + strlen (p) + 1;
line = rc_xmalloc (sizeof (char *) * i);
snprintf (line, i, "RC_TTY=%s", p);
env = rc_strlist_add (env, line);
free (p);
free (line);
}
}
memset (sys, 0, sizeof (sys));
#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 */
#ifdef __linux__
memset (sys, 0, sizeof (sys));
if (rc_is_dir ("/proc/xen")) {
fp = fopen ("/proc/xen/capabilities", "r");
if (fp) {
@ -690,6 +679,15 @@ char **rc_config_env (char **env)
{
snprintf (sys, sizeof (sys), "VPS");
}
if (sys[0]) {
i = strlen ("RC_SYS=") + strlen (sys) + 2;
line = rc_xmalloc (sizeof (char *) * i);
snprintf (line, i, "RC_SYS=%s", sys);
env = rc_strlist_add (env, line);
free (line);
}
#endif
/* Only add a NET_FS list if not defined */
@ -707,14 +705,6 @@ char **rc_config_env (char **env)
free (line);
}
if (sys[0]) {
i = strlen ("RC_SYS=") + strlen (sys) + 2;
line = rc_xmalloc (sizeof (char *) * i);
snprintf (line, i, "RC_SYS=%s", sys);
env = rc_strlist_add (env, line);
free (line);
}
/* 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) {