From e79950d93af06b735b86548120dc60b2c5be6ee0 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 13 May 2004 08:34:50 +0000 Subject: 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) --- mdk-stage1/tools.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'mdk-stage1/tools.c') 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"); } -- cgit v1.2.1