From 6649d2bd7b512f96a42ed9035291f97b4a5ef3c5 Mon Sep 17 00:00:00 2001 From: forever2k38 Date: Mon, 7 Sep 2026 12:59:05 +0200 Subject: fix: skip temporary directory creation error if it already exists --- src/paths.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/paths.c') diff --git a/src/paths.c b/src/paths.c index 5c8121a..d4239ff 100644 --- a/src/paths.c +++ b/src/paths.c @@ -1,12 +1,23 @@ #include "paths.h" +#include "errno.h" #include "stdio.h" #include "stdlib.h" #include "string.h" +#include "sys/stat.h" +#include "unistd.h" char template[] = "/tmp/pow/XXXXXX"; int pow_create_dir_for_package(char **path) { + if (mkdir("/tmp/pow", 0700)) { + if (errno != EEXIST) { + printf("failed to create temp dir\n"); + + return 1; + } + } + char *new_path = malloc(strlen(template) + 1); if (!new_path) { -- cgit v1.3