pg: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
28941d202a
commit
45f40a1ed8
|
@ -597,11 +597,8 @@ static int getcount(char *cmdstr)
|
||||||
}
|
}
|
||||||
if (buf[0] == '-' && buf[1] == '\0') {
|
if (buf[0] == '-' && buf[1] == '\0') {
|
||||||
i = -1;
|
i = -1;
|
||||||
} else {
|
} else if (ul_strtos32(*buf == '+' ? buf + 1 : buf, &i, 10) != 0) {
|
||||||
if (*buf == '+')
|
i = -1;
|
||||||
i = atoi(buf + 1);
|
|
||||||
else
|
|
||||||
i = atoi(buf);
|
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
return i;
|
return i;
|
||||||
|
|
Loading…
Reference in New Issue