From 03a33fc0eeb5e341948d60403ab97d8231cd974a Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 18 Oct 2017 22:56:02 +0200 Subject: [PATCH] Check stat() return value, found by Coverity Scan Signed-off-by: Joachim Nilsson --- src/conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index f82bb75b..15f3971c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -479,6 +479,7 @@ int conf_reload_dynamic(void) /* Check that it's an actual file ... beyond any symlinks */ if (lstat(path, &st)) { + lost: _d("Skipping %s, cannot access: %s", path, strerror(errno)); continue; } @@ -513,7 +514,9 @@ int conf_reload_dynamic(void) continue; } - stat(path, &st); + if (stat(path, &st)) + goto lost; /* Weird, lost file between here and lstat() */ + TIMESPEC_TO_TIMEVAL(&mtime, &st.st_mtim); parse_conf_dynamic(path, &mtime); }