summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-08-17 08:59:07 +0200
committerGitHub <noreply@github.com>2024-08-17 08:59:07 +0200
commit5ef91261d99a729f1d281b0ac7f47032089ecfbf (patch)
tree9307b402e9aeae28e833333394fc864335ad0bbc
parent45d8ca97291128e1549ee7bcba7eed6ac6bdfdb3 (diff)
parent1c0105099b9e86ada9967bdb9557501fdf434afa (diff)
downloadvyos-1x-5ef91261d99a729f1d281b0ac7f47032089ecfbf.tar.gz
vyos-1x-5ef91261d99a729f1d281b0ac7f47032089ecfbf.zip
Merge pull request #3994 from vyos/mergify/bp/sagitta/pr-3989
utils: T6658: fix write_file check in case of empty directory path (backport #3989)
-rw-r--r--python/vyos/utils/file.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/utils/file.py b/python/vyos/utils/file.py
index 0818f1b81..e16d5b40d 100644
--- a/python/vyos/utils/file.py
+++ b/python/vyos/utils/file.py
@@ -51,7 +51,7 @@ def write_file(fname, data, defaultonfailure=None, user=None, group=None, mode=N
If directory of file is not present, it is auto-created.
"""
dirname = os.path.dirname(fname)
- if not os.path.isdir(dirname):
+ if dirname and not os.path.isdir(dirname):
os.makedirs(dirname, mode=0o755, exist_ok=False)
chown(dirname, user, group)