diff --git a/src/main.cc b/src/main.cc index eff5ec3..e7835d7 100644 --- a/src/main.cc +++ b/src/main.cc @@ -8,7 +8,7 @@ #include static char preprocessed_fname[] = "/tmp/cxlppXXXXXX"; -static char c_fname[] = "/tmp/cxlcXXXXXX"; +static char c_fname[] = "/tmp/cxlcXXXXXX.c"; static bool preprocessed_fname_created = false; static bool c_fname_created = false; @@ -71,7 +71,7 @@ void write_node(FILE * file, Node * node) bool emit_c(Node * node) { - int fd = mkstemp(c_fname); + int fd = mkstemps(c_fname, 2); if (fd < 0) { perror("mkstemp"); @@ -94,7 +94,7 @@ bool compile() } else if (pid == 0) { - execlp("gcc", "gcc", "-x", "c", "-c", c_fname, "-o", "out.o", NULL); + execlp("gcc", "gcc", "-c", c_fname, "-o", "out.o", NULL); } else {