improve mkdtemp error message

This commit is contained in:
Emil J. Tywoniak 2025-02-26 12:06:54 +01:00
parent b4a169527d
commit 78cb10da69
1 changed files with 4 additions and 1 deletions

View File

@ -413,8 +413,11 @@ std::string make_temp_dir(std::string template_str)
# endif
char *p = strdup(template_str.c_str());
log_assert(p);
char *res = mkdtemp(p);
log_assert(res != NULL);
if (!res)
log_error("mkdtemp failed for '%s': %s [Error %d]\n",
p, strerror(errno), errno);
template_str = p;
free(p);