mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-14 01:02:04 +03:00
FreeBSD: Fix uninitialized variable error
On FreeBSD errno is defined as (* __error()), which means compiler can't say whether two consecutive reads will return the same. And without this knowledge the reported error is formally right. Caching of the errno in local variable fixes the issue. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #17975
This commit is contained in:
parent
c8ecd63acd
commit
2e09f166f0
@ -124,10 +124,12 @@ zfs_tunable_parse_int(const char *val, intmax_t *np,
|
||||
{
|
||||
intmax_t n;
|
||||
char *end;
|
||||
int err;
|
||||
|
||||
errno = 0;
|
||||
n = strtoimax(val, &end, 0);
|
||||
if (errno != 0)
|
||||
return (errno);
|
||||
if ((err = errno) != 0)
|
||||
return (err);
|
||||
if (*end != '\0')
|
||||
return (EINVAL);
|
||||
if (n < min || n > max)
|
||||
@ -142,10 +144,12 @@ zfs_tunable_parse_uint(const char *val, uintmax_t *np,
|
||||
{
|
||||
uintmax_t n;
|
||||
char *end;
|
||||
int err;
|
||||
|
||||
errno = 0;
|
||||
n = strtoumax(val, &end, 0);
|
||||
if (errno != 0)
|
||||
return (errno);
|
||||
if ((err = errno) != 0)
|
||||
return (err);
|
||||
if (*end != '\0')
|
||||
return (EINVAL);
|
||||
if (strchr(val, '-'))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user