Windows: port TempDir/TempFile and fix file-system semantics
- TempDir/TempFile: implement the Windows branch (path-based no-follow cleanup, volume/file-index identity, normalized temp base). - Path: let the staging cleanup delete the temp file while its handle is open (FILE_SHARE_DELETE) and open the parent directory with write access before FlushFileBuffers. - Configuration: read the environment through _environ on Windows. - Tests: binary ofstream for read_file, portable setenv/getpid, skip DirectoryWatcher on Windows, builtin Ed25519 vector, Archive hardening permission assertions guarded. Verified under Wine 11 with x86_64-w64-mingw32 GCC 16.2: Archive 6/6, ArchiveHardening 10/10, Crypto 3/3, Path 9/11 (2 skipped), TempDir 5/5, TempFile 5/5, Sources 7/7, DirectoryWatcher skipped (no backend), Log 12/12. Linux suites unchanged (477 and 787 tests, 0 failures). Refs #65
This commit is contained in:
1 parent
a48c745438
commit
3939b05396
11 files changed
+291
-30
No files matched your search
@@ -30,6 +30,11 @@
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
extern char** environ; // NOLINT
|
||||
#define VOID_CONFIG_HAS_ENVIRON 1
|
||||
#define VOID_CONFIG_ENVIRON environ
|
||||
#elif defined(_WIN32)
|
||||
extern char** _environ; // NOLINT
|
||||
#define VOID_CONFIG_HAS_ENVIRON 1
|
||||
#define VOID_CONFIG_ENVIRON _environ
|
||||
#endif
|
||||
|
||||
namespace Void::Configuration
|
||||
@@ -178,7 +183,7 @@ namespace Void::Configuration
|
||||
{
|
||||
Config cfg;
|
||||
#ifdef VOID_CONFIG_HAS_ENVIRON
|
||||
for (char** env = environ; *env != nullptr; ++env) {
|
||||
for (char** env = VOID_CONFIG_ENVIRON; *env != nullptr; ++env) {
|
||||
const std::string_view kv{*env};
|
||||
const auto eq = kv.find('=');
|
||||
if (eq == std::string_view::npos ||
|
||||
|
||||
Reference in new issue
Block a user