summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-04-03 09:24:33 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-04-03 09:24:33 +0200
commitff3d733095f23068056e8e3273a343d10149e87e (patch)
treeba04e423b97067a7d01a8406eb1109d016593f6e
parent9a74a955291e6232543e1a08e48066a930cfca5a (diff)
downloadpython-linuxnamespaces-ff3d733095f23068056e8e3273a343d10149e87e.tar.gz
AtLocation.walk: add support for AT_EMPTY_PATH
-rw-r--r--linuxnamespaces/atlocation.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/linuxnamespaces/atlocation.py b/linuxnamespaces/atlocation.py
index 24c2cce..6aada55 100644
--- a/linuxnamespaces/atlocation.py
+++ b/linuxnamespaces/atlocation.py
@@ -505,7 +505,7 @@ class AtLocation:
AtLocations referencing the same object as the dirpath though as an
AT_EMPTY_PATH with temporary fd.
"""
- if self.flags != AtFlags.NONE:
+ if self.flags & ~AtFlags.AT_EMPTY_PATH != AtFlags.NONE:
raise NotImplementedError(
"walk is not supported for an AtLocation with flags"
)
@@ -513,7 +513,7 @@ class AtLocation:
if follow_symlinks:
flags = AtFlags.NONE
for dirpath, dirnames, filenames, dirfd in os.fwalk(
- self.location,
+ "." if self.flags & AtFlags.AT_EMPTY_PATH else self.location,
topdown=topdown,
onerror=onerror,
follow_symlinks=follow_symlinks,