summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-07-12 09:48:44 +0000
committerRoy Marples <roy@marples.name>2007-07-12 09:48:44 +0000
commit06e687598d76fc2470c19d10f182e8edd8cc9845 (patch)
tree7a027d37998d8d830d62a07da534876ae7a18431
parent685aa53dce51485f871fa13ddd47d03f5ff17701 (diff)
downloadopenrc-06e687598d76fc2470c19d10f182e8edd8cc9845.tar.gz
openrc-06e687598d76fc2470c19d10f182e8edd8cc9845.tar.bz2
openrc-06e687598d76fc2470c19d10f182e8edd8cc9845.tar.xz
Punt the RC_TTY variable
-rw-r--r--src/librc-misc.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c
index 6436e0b..fd1282a 100644
--- a/src/librc-misc.c
+++ b/src/librc-misc.c
@@ -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) {