From 083151360e2fd91736aba74eb7a101a887e20a80 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Tue, 6 Jun 2023 21:17:40 +0200 Subject: [PATCH] return an error in case configuration file can't be opened (#1920) --- internal/conf/conf.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/conf/conf.go b/internal/conf/conf.go index e2a6db15..7c489e22 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -4,6 +4,7 @@ package conf import ( "bytes" "encoding/json" + "errors" "fmt" "os" "sort" @@ -43,7 +44,7 @@ func loadFromFile(fpath string, conf *Conf) (bool, error) { // mediamtx.yml is optional // other configuration files are not if fpath == "mediamtx.yml" || fpath == "rtsp-simple-server.yml" { - if _, err := os.Stat(fpath); err != nil { + if _, err := os.Stat(fpath); errors.Is(err, os.ErrNotExist) { conf.UnmarshalJSON(nil) // load defaults return false, nil }