Allow M2-Mesoplanet to work on systems without /tmp
such as live-bootstrap
This commit is contained in:
parent
bb0260eb1b
commit
03bd6bda76
14
cc.c
14
cc.c
|
@ -288,8 +288,18 @@ int main(int argc, char** argv, char** envp)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char* prefix = calloc(10, sizeof(char));
|
||||||
|
if(0 == access("/tmp", 0))
|
||||||
|
{
|
||||||
|
strcpy(prefix, "/tmp/");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(prefix, "tmp-");
|
||||||
|
}
|
||||||
name = calloc(100, sizeof(char));
|
name = calloc(100, sizeof(char));
|
||||||
strcpy(name, "/tmp/M2-Mesoplanet-XXXXXX");
|
strcpy(name, prefix);
|
||||||
|
strcat(name, "M2-Mesoplanet-XXXXXX");
|
||||||
i = mkstemp(name);
|
i = mkstemp(name);
|
||||||
tempfile = fdopen(i, "w");
|
tempfile = fdopen(i, "w");
|
||||||
if(NULL != tempfile)
|
if(NULL != tempfile)
|
||||||
|
@ -299,7 +309,7 @@ int main(int argc, char** argv, char** envp)
|
||||||
fclose(tempfile);
|
fclose(tempfile);
|
||||||
|
|
||||||
/* Make me a real binary */
|
/* Make me a real binary */
|
||||||
spawn_processes(debug_flag, name, destination_name, envp);
|
spawn_processes(debug_flag, prefix, name, destination_name, envp);
|
||||||
|
|
||||||
/* And clean up the donkey */
|
/* And clean up the donkey */
|
||||||
if(!DIRTY_MODE) remove(name);
|
if(!DIRTY_MODE) remove(name);
|
||||||
|
|
11
cc_spawn.c
11
cc_spawn.c
|
@ -414,13 +414,14 @@ void spawn_M2(char* input, char* output, char* architecture, char** envp, int de
|
||||||
_execute("M2-Planet", array, envp);
|
_execute("M2-Planet", array, envp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spawn_processes(int debug_flag, char* preprocessed_file, char* destination, char** envp)
|
void spawn_processes(int debug_flag, char* prefix, char* preprocessed_file, char* destination, char** envp)
|
||||||
{
|
{
|
||||||
int large_flag = FALSE;
|
int large_flag = FALSE;
|
||||||
if(WORDSIZE > 32) large_flag = TRUE;
|
if(WORDSIZE > 32) large_flag = TRUE;
|
||||||
|
|
||||||
char* M2_output = calloc(100, sizeof(char));
|
char* M2_output = calloc(100, sizeof(char));
|
||||||
strcpy(M2_output, "/tmp/M2-Planet-XXXXXX");
|
strcpy(M2_output, prefix);
|
||||||
|
strcat(M2_output, "M2-Planet-XXXXXX");
|
||||||
int i = mkstemp(M2_output);
|
int i = mkstemp(M2_output);
|
||||||
if(-1 != i)
|
if(-1 != i)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +438,8 @@ void spawn_processes(int debug_flag, char* preprocessed_file, char* destination,
|
||||||
if(debug_flag)
|
if(debug_flag)
|
||||||
{
|
{
|
||||||
blood_output = calloc(100, sizeof(char));
|
blood_output = calloc(100, sizeof(char));
|
||||||
strcpy(blood_output, "/tmp/blood-elf-XXXXXX");
|
strcpy(blood_output, prefix);
|
||||||
|
strcat(blood_output, "blood-elf-XXXXXX");
|
||||||
i = mkstemp(blood_output);
|
i = mkstemp(blood_output);
|
||||||
if(-1 != i)
|
if(-1 != i)
|
||||||
{
|
{
|
||||||
|
@ -452,7 +454,8 @@ void spawn_processes(int debug_flag, char* preprocessed_file, char* destination,
|
||||||
}
|
}
|
||||||
|
|
||||||
char* M1_output = calloc(100, sizeof(char));
|
char* M1_output = calloc(100, sizeof(char));
|
||||||
strcpy(M1_output, "/tmp/M1-macro-XXXXXX");
|
strcpy(M1_output, prefix);
|
||||||
|
strcat(M1_output, "M1-macro-XXXXXX");
|
||||||
i = mkstemp(M1_output);
|
i = mkstemp(M1_output);
|
||||||
if(-1 != i)
|
if(-1 != i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue