From 58125b64c6678ea581998c9f83a19fae0cdbda12 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 15 Aug 2024 13:29:21 -0500 Subject: utils: T6658: fix write_file check in case of empty directory path --- python/vyos/utils/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') 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) -- cgit v1.2.3