aboutsummaryrefslogtreecommitdiff
path: root/src/paths.c
diff options
context:
space:
mode:
authorforever2k38 <forever2k38@noreply.codeberg.org>2026-09-07 12:59:05 +0200
committerforever2k38 <forever2k38@noreply.codeberg.org>2026-09-07 12:59:05 +0200
commit6649d2bd7b512f96a42ed9035291f97b4a5ef3c5 (patch)
treea4551c9f8cae562da3a12b2ef76d064adc6be396 /src/paths.c
parent1371aac8280c8281d7b79926fc7b8d8e38cda3ab (diff)
fix: skip temporary directory creation error if it already exists
Diffstat (limited to 'src/paths.c')
-rw-r--r--src/paths.c11
1 files changed, 11 insertions, 0 deletions
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) {