[web] Fixed failures when creating tmp files on linxu

This commit is contained in:
Sidi Liang 2024-11-07 11:30:54 +08:00
parent d3d204a704
commit eae25eeb9a
No known key found for this signature in database
GPG Key ID: 9785F5EECFFA5311
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ const char* nasal_eval(void* context, const char* code, int show_time) {
// Create a unique temporary file
char temp_filename[256];
snprintf(temp_filename, sizeof(temp_filename), "/tmp/nasal_eval_%ld.nasal", std::time(nullptr));
snprintf(temp_filename, sizeof(temp_filename), "/tmp/nasal_eval_%ld_XXXXXX", std::time(nullptr));
int fd = mkstemp(temp_filename);
if (fd == -1) {
throw std::runtime_error("Failed to create temporary file");