summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/tools.c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-05-13 08:34:50 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-05-13 08:34:50 +0000
commite79950d93af06b735b86548120dc60b2c5be6ee0 (patch)
treecd0d96ad02a9febbbf7b00071c84d89adf81fdc0 /mdk-stage1/tools.c
parent29a2a329574efc2b945de3d9f2dc08803c6dafd9 (diff)
downloaddrakx-e79950d93af06b735b86548120dc60b2c5be6ee0.tar
drakx-e79950d93af06b735b86548120dc60b2c5be6ee0.tar.gz
drakx-e79950d93af06b735b86548120dc60b2c5be6ee0.tar.bz2
drakx-e79950d93af06b735b86548120dc60b2c5be6ee0.tar.xz
drakx-e79950d93af06b735b86548120dc60b2c5be6ee0.zip
instead of keeping stage1 (mostly as temporary space but with a fixed size, and for the background init),
exit the stage1 giving hand to stage2 in a tmpfs (same as what was done for Mandrakemove)
Diffstat (limited to 'mdk-stage1/tools.c')
-rw-r--r--mdk-stage1/tools.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index dbbd45772..76a70dec0 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -410,31 +410,16 @@ void * memdup(void *src, size_t size)
}
-static char ** my_env = NULL;
-static int env_size = 0;
-
-void handle_env(char ** env)
-{
- char ** ptr = env;
- while (ptr && *ptr) {
- ptr++;
- env_size++;
- }
- my_env = malloc(sizeof(char *) * 100);
- memcpy(my_env, env, sizeof(char *) * (env_size+1));
-}
-
-char ** grab_env(void) {
- return my_env;
-}
-
void add_to_env(char * name, char * value)
{
- char tmp[500];
- sprintf(tmp, "%s=%s", name, value);
- my_env[env_size] = strdup(tmp);
- env_size++;
- my_env[env_size] = NULL;
+ FILE* fakeenv = fopen(SLASH_LOCATION "/tmp/env", "a");
+ if (fakeenv) {
+ char* e = asprintf_("%s=%s\n", name, value);
+ fwrite(e, 1, strlen(e), fakeenv);
+ free(e);
+ fclose(fakeenv);
+ } else
+ log_message("couldn't fopen to fake env");
}