From: Christian Brauner Date: Thu, 1 Apr 2021 08:56:52 +0000 (+0200) Subject: string_utils: ensure that errno is set on return X-Git-Tag: lxc-5.0.0~221^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90e69d7178610809e0531a77182dc12869455f9e;p=thirdparty%2Flxc.git string_utils: ensure that errno is set on return Signed-off-by: Christian Brauner --- diff --git a/src/lxc/string_utils.c b/src/lxc/string_utils.c index e5321d826..a5bc7cced 100644 --- a/src/lxc/string_utils.c +++ b/src/lxc/string_utils.c @@ -657,7 +657,7 @@ int lxc_safe_int64_residual(const char *numstr, int64_t *converted, int base, ch errno = 0; u = strtoll(numstr, &remaining, base); if (errno == ERANGE && u == INT64_MAX) - return -ERANGE; + return ret_errno(ERANGE); if (remaining == numstr) return -EINVAL; @@ -670,11 +670,11 @@ int lxc_safe_int64_residual(const char *numstr, int64_t *converted, int base, ch len = strlen(remaining); if (len >= residual_len) - return -EINVAL; + return ret_errno(EINVAL); memcpy(residual, remaining, len); } else if (*remaining != '\0') { - return -EINVAL; + return ret_errno(EINVAL); } out: