From 7bf3c5b692f34bd6d9467ac3c651692c885a1d90 Mon Sep 17 00:00:00 2001 From: forever2k38 Date: Fri, 4 Sep 2026 12:45:43 +0200 Subject: filesystem fuckery --- src/paths.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/paths.c (limited to 'src/paths.c') 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; +} -- cgit v1.3