From 5e7f3526eba079b0ebc5d602714ddc907ae0c57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 12 Feb 2019 11:52:00 +0200 Subject: [PATCH] cmd/utils: make fdlimit happy path a bit cleaner --- cmd/utils/flags.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 4abc6e0203..339609cf4e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -950,12 +950,11 @@ func makeDatabaseHandles() int { if err != nil { Fatalf("Failed to retrieve file descriptor allowance: %v", err) } - if u64limit, err := fdlimit.Raise(uint64(limit)); err != nil { + raised, err := fdlimit.Raise(uint64(limit)) + if err != nil { Fatalf("Failed to raise file descriptor allowance: %v", err) - return 0 // Make the compiler happy - } else { - return int(u64limit / 2) // Leave half for networking and other stuff } + return int(raised / 2) // Leave half for networking and other stuff } // MakeAddress converts an account specified directly as a hex encoded string or