[web] Make the temporary file name actually unique to handle concurrent requests
This commit is contained in:
parent
40976bf0c1
commit
8dc06c085c
|
@ -84,7 +84,8 @@ const char* nasal_eval(void* context, const char* code, int show_time) {
|
||||||
nasal::codegen gen;
|
nasal::codegen gen;
|
||||||
|
|
||||||
// Create a unique temporary file
|
// Create a unique temporary file
|
||||||
char temp_filename[] = "/tmp/nasal_eval_XXXXXX.nasal";
|
char temp_filename[256];
|
||||||
|
snprintf(temp_filename, sizeof(temp_filename), "/tmp/nasal_eval_%d.nasal", getpid());
|
||||||
int fd = mkstemp(temp_filename);
|
int fd = mkstemp(temp_filename);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
throw std::runtime_error("Failed to create temporary file");
|
throw std::runtime_error("Failed to create temporary file");
|
||||||
|
|
Loading…
Reference in New Issue