diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2024-10-09 23:48:51 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2024-10-16 13:03:41 +0200 |
commit | a890f55241dc6357fa5c295807978eea137abe5a (patch) | |
tree | 9a6bdb033c93aee39cd60f7e240e023ac54db22f /utils.c | |
parent | d70d3cff8f0295b93c2035114aef2fa705177748 (diff) |
Added additional is-a-file check
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -705,6 +705,16 @@ int parse_config_file(char const * const config_file, config_line_callback cb, v { FILE * file; int error; + struct stat sbuf; + + if (stat(config_file, &sbuf) != 0) + { + return -1; + } + if ((sbuf.st_mode & S_IFMT) != S_IFREG) + { + return -ENOENT; + } file = fopen(config_file, "r"); if (file == NULL) |