diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-26 01:33:48 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-26 01:34:03 -0400 |
| commit | d2892e347a619325550fa45cb8da5914bf2a5343 (patch) | |
| tree | 2e07b0088bcb010b20e24d63a92e38f05bcf1b82 | |
| parent | 2596f879f9cc8a6eab4fd2991d9639ef22753b62 (diff) | |
| download | stasis-d2892e347a619325550fa45cb8da5914bf2a5343.tar.gz | |
xmkstemp: create sub-directories if needed
| -rw-r--r-- | src/lib/core/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/core/utils.c b/src/lib/core/utils.c index 4843e5a..90dac1d 100644 --- a/src/lib/core/utils.c +++ b/src/lib/core/utils.c @@ -505,6 +505,11 @@ char *xmkstemp(FILE **fp, const char *mode) { } tmpdir[sizeof(tmpdir) - 1] = '\0'; + if (mkdirs(tmpdir, 0700) < 0) { + SYSERROR("unable to create sub-directories in %s", tmpdir); + return NULL; + } + memset(t_name, 0, sizeof(t_name)); snprintf(t_name, sizeof(t_name), "%s/%s", tmpdir, "STASIS.XXXXXX"); @@ -665,6 +670,7 @@ int fix_tox_conf(const char *filename, char **result, size_t maxlen) { // Create new temporary tox configuration file char *tempfile = xmkstemp(&fptemp, "w+"); if (!tempfile) { + SYSERROR("%s", "unable to create temporary file"); return -1; } |
