From c6583e84d1d2f9e05ea2a0f99603713322a06e45 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 19 Jun 2017 10:06:47 +0100 Subject: [PATCH] load_service: remove another TODO. It's not worth writing a number parser just so we can error out if the user happens to specify a value of -0 (only >= 0 is allowed). --- src/load_service.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/load_service.cc b/src/load_service.cc index 8ebab76..b1f1227 100644 --- a/src/load_service.cc +++ b/src/load_service.cc @@ -278,9 +278,7 @@ static gid_t parse_gid_param(const std::string ¶m, const std::string &servic // is is probably safe to assume that valid values are positive. We'll also assume // that the value range fits with "unsigned long long" since it seems unlikely // that would ever not be the case. - // - // TODO perhaps write a number parser, since even the unsigned variants of the C/C++ - // functions accept a leading minus sign... + static_assert((uintmax_t)std::numeric_limits::max() <= (uintmax_t)std::numeric_limits::max(), "gid_t is too large"); unsigned long long v = std::stoull(param, &ind, 0); if (v > static_cast(std::numeric_limits::max()) || ind != param.length()) { throw service_description_exc(service_name, gid_err_msg); -- 2.25.1