From acdb3dcac077fff6f1165b2e0ff05f4c743d9444 Mon Sep 17 00:00:00 2001 From: Alexey Lesovsky Date: Wed, 25 Aug 2021 15:01:18 +0500 Subject: [PATCH] Fix possible segfault, when getting stat for non-existent Postgres config file. --- internal/collector/postgres_settings.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/collector/postgres_settings.go b/internal/collector/postgres_settings.go index 54a6709..c00ea0a 100644 --- a/internal/collector/postgres_settings.go +++ b/internal/collector/postgres_settings.go @@ -222,6 +222,7 @@ func parsePostgresFiles(r *model.PGResult) []postgresFile { fi, err := os.Stat(path) if err != nil { log.Warnf("stat %s failed: %s; skip", path, err) + continue } mode := fmt.Sprintf("%04o", fi.Mode().Perm())