From 8232000524f4fe20d18f0694cd75d0b4ff7fa710 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 10 Aug 2021 08:55:24 +0200 Subject: [PATCH] Don't allow 0 for max_connections database option 0 stands for deactivate, which makes no sense here. --- pkg/icingadb/db.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/icingadb/db.go b/pkg/icingadb/db.go index caaea880..51ff8b9e 100644 --- a/pkg/icingadb/db.go +++ b/pkg/icingadb/db.go @@ -67,6 +67,9 @@ func (o *Options) UnmarshalYAML(unmarshal func(interface{}) error) error { return internal.CantUnmarshalYAML(err, o) } + if o.MaxConnections == 0 { + return errors.New("max_connections cannot be 0. Configure a value greater than zero, or use -1 for no connection limit") + } if o.MaxConnectionsPerTable < 1 { return errors.New("max_connections_per_table must be at least 1") }