diff options
| author | forever2k38 <forever2k38@noreply.codeberg.org> | 2026-09-04 12:45:43 +0200 |
|---|---|---|
| committer | forever2k38 <forever2k38@noreply.codeberg.org> | 2026-09-04 12:45:43 +0200 |
| commit | 7bf3c5b692f34bd6d9467ac3c651692c885a1d90 (patch) | |
| tree | ea2d9abb30b1e4ce5451b52c11d782f6d14e5686 /src/paths.c | |
| parent | ed979ea2b7cc0caf3abb47dce94e02ef16c73e65 (diff) | |
filesystem fuckery
Diffstat (limited to 'src/paths.c')
| -rw-r--r-- | src/paths.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/paths.c b/src/paths.c new file mode 100644 index 0000000..20af56d --- /dev/null +++ b/src/paths.c @@ -0,0 +1,28 @@ +#include "paths.h" + +#include "stdio.h" +#include "stdlib.h" +#include "string.h" + +char template[] = "/tmp/pow/XXXXXX"; + +int pow_create_dir_for_package(char **path) { + char *new_path = malloc(strlen(template) + 1); + + if (!new_path) { + return 1; + } + + strcpy(new_path, template); + + if (!mkdtemp(new_path)) { + free(new_path); + return 1; + } + + printf("%s\n", new_path); + + *path = new_path; + + return 0; +} |
