conf: Return an error if zlog_init is called with a non-regular file#279
conf: Return an error if zlog_init is called with a non-regular file#279iancuivasciuc wants to merge 1 commit intoHardySimpson:masterfrom
Conversation
|
I think a symbolic link should be accepted too. |
|
I don’t have extensive experience, so I could be mistaken. If I only check that the file is a symlink, it could still point to something other than a regular file, which should be avoided. Shouldn't the stat command be used directly? I also noticed that stat is used directly in other parts of the project. |
Currently, calling zlog_init with a non-regular file (e.g., a directory) didn’t return an error. The logger would have been configured the same as with an empty file. The file is now checked to ensure it is regular, and an error is returned if it is not. Fixes HardySimpson#278.
723f46d to
2623995
Compare
you can use realpath first |
But is there a problem with the current pr? |
Currently, calling zlog_init with a non-regular file (e.g., a directory) didn’t return an error. The logger would have been configured the same as with an empty file.
The file is now checked to ensure it is regular, and an error is returned if it is not.
Fixes #278.