]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
util: Set errno to 0 before strtol/stroul call
authorDaniel Wagner <dwagner@suse.de>
Fri, 11 Aug 2023 12:24:04 +0000 (14:24 +0200)
committerDaniel Wagner <wagi@monom.org>
Fri, 11 Aug 2023 12:40:00 +0000 (14:40 +0200)
In order to be able to distinguish between success/failure case when
calling strtol/stroul we set errno explicitly to 0.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
util/argconfig.c

index 78f3a6c37ed2b3924a860cf4a294d078e01ef7ec..91f499813d3a039d2e68b274046e6504b8781e67 100644 (file)
@@ -164,6 +164,8 @@ static int argconfig_parse_type(struct argconfig_commandline_options *s, struct
        char *endptr;
        int ret = 0;
 
+       errno = 0;    /* To distinguish success/failure after strtol/stroul call */
+
        switch (s->config_type) {
        case CFG_STRING:
                *((char **)value) = optarg;