summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)