Skip to content

Commit 28287eb

Browse files
authored
Try cache mkdir in XDG handling
1 parent b2f6dec commit 28287eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scapy/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def _probe_xdg_folder(var, default, *cf):
7373
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
7474
# "If, when attempting to write a file, the destination directory is
7575
# non-existent an attempt should be made to create it with permission 0700."
76-
path.mkdir(mode=0o700, exist_ok=True)
76+
try:
77+
path.mkdir(mode=0o700, exist_ok=True)
78+
except Exception:
79+
# There is a gazillion ways this can fail. Most notably,
80+
# a read-only fs.
81+
return None
7782
return path.joinpath(*cf).resolve()
7883

7984

0 commit comments

Comments
 (0)