25 lines
950 B
Diff
25 lines
950 B
Diff
|
From d204b41dba231ffbb648d11c5bcbd3cd3c84f519 Mon Sep 17 00:00:00 2001
|
||
|
From: Andrey Semashev <andrey.semashev@gmail.com>
|
||
|
Date: Thu, 15 Dec 2022 15:53:42 +0300
|
||
|
Subject: [PATCH] Use access() to check if the root directory is writable.
|
||
|
|
||
|
This is more reliable than testing if the user is root as in some
|
||
|
chroot environments root directory may be writable by a non-root user.
|
||
|
---
|
||
|
test/operations_test.cpp | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/libs/filesystem/test/operations_test.cpp b/libs/filesystem/test/operations_test.cpp
|
||
|
index 4e3c2b966..65858a4e6 100644
|
||
|
--- a/libs/filesystem/test/operations_test.cpp
|
||
|
+++ b/libs/filesystem/test/operations_test.cpp
|
||
|
@@ -1232,7 +1232,7 @@ void create_directories_tests()
|
||
|
BOOST_TEST(!ec);
|
||
|
|
||
|
#ifdef BOOST_POSIX_API
|
||
|
- if (geteuid() > 0)
|
||
|
+ if (access("/", W_OK) != 0)
|
||
|
{
|
||
|
ec.clear();
|
||
|
BOOST_TEST(!fs::create_directories("/foo", ec)); // may be OK on Windows
|