Add cross-platform utun_mkdir() wrapper for Windows compatibility

This commit is contained in:
Evgeny committed 2026-07-13 06:44:18 +03:00
1 parent de7841f33a
commit e438e19f9e
3 files changed
+20 -5

No files matched your search

+7 -1
View File
@@ -30,6 +30,7 @@
#include "../lib/platform_compat.h"
#include "../lib/mem.h"
#include "../lib/ll_queue.h"
#include <openssl/sha.h>
@@ -92,6 +93,11 @@ static int instance_init_common(struct UTUN_INSTANCE* instance, struct UASYNC* u
DEBUG_ERROR(DEBUG_CATEGORY_CRYPTO, "Failed to derive Ed25519 pubkey");
return -1;
}
{
uint8_t ed_priv_hash[SHA512_DIGEST_LENGTH];
SHA512(instance->my_keys.private_key, SC_PRIVKEY_SIZE, ed_priv_hash);
memcpy(instance->my_ed25519_privkey, ed_priv_hash, SC_PRIVKEY_SIZE);
}
DEBUG_INFO(DEBUG_CATEGORY_CRYPTO, "Ed25519 pubkey derived successfully");
// Initialize networks queue (indexed by 56-bit network id)
@@ -287,7 +293,7 @@ struct UTUN_INSTANCE* utun_instance_create(struct UASYNC* ua, const char *config
}
int remaining = (int)(sizeof(instance->stats_dir) - dir_len - 8);
if (remaining > 0) snprintf(instance->stats_dir + dir_len, remaining, "/stats");
mkdir(instance->stats_dir, 0755);
utun_mkdir(instance->stats_dir, 0755);
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "Metrics stats dir: %s", instance->stats_dir);
}