summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-08-16 21:27:57 +0300
committerGitHub <noreply@github.com>2024-08-16 21:27:57 +0300
commita43b5c7d1ca00fe67af08ae576889e657ac9b7b0 (patch)
treee7abd86dea573a018f1e423c52c0b907b29337a6
parent1ffdf48642e454d7f9ddead8d79f19b96dea00d4 (diff)
downloadvyos-1x-a43b5c7d1ca00fe67af08ae576889e657ac9b7b0.tar.gz
vyos-1x-a43b5c7d1ca00fe67af08ae576889e657ac9b7b0.zip
utils: T6658: fix write_file check in case of empty directory path (#3993)
(cherry picked from commit 58125b64c6678ea581998c9f83a19fae0cdbda12) Co-authored-by: John Estabrook <jestabro@vyos.io>
-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 c566f0334..eaebb57a3 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)