diff options
author | Christian Breunig <christian@breunig.cc> | 2024-08-16 07:58:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-16 07:58:49 +0200 |
commit | cb1eec686cfe7b64142980963d44ae47a4eb66cc (patch) | |
tree | 2deecb297e6283b766df6fcc54f48e69a45f10f8 | |
parent | e7f3c9a5c59a81ef5bc9a39c2fdba0f9324acdd5 (diff) | |
parent | 58125b64c6678ea581998c9f83a19fae0cdbda12 (diff) | |
download | vyos-1x-cb1eec686cfe7b64142980963d44ae47a4eb66cc.tar.gz vyos-1x-cb1eec686cfe7b64142980963d44ae47a4eb66cc.zip |
Merge pull request #3989 from jestabro/write_file-err
utils: T6658: fix write_file check in case of empty directory path
-rw-r--r-- | python/vyos/utils/file.py | 2 |
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) |