summaryrefslogtreecommitdiffstats
path: root/isys/isys.c
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-06-27 03:25:34 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-06-27 03:25:38 -1000
commit83389b2effe828debfbbcbebf87dbfd2cc12e361 (patch)
treeaeaffe2d818605590ffce1be6e894f861496fdd5 /isys/isys.c
parentadfa32b7ae12e10545c927f71655aaef950013a0 (diff)
downloadanaconda-83389b2effe828debfbbcbebf87dbfd2cc12e361.tar.gz
anaconda-83389b2effe828debfbbcbebf87dbfd2cc12e361.tar.xz
anaconda-83389b2effe828debfbbcbebf87dbfd2cc12e361.zip
Per strtol(3) man page, set errno=0 before call.
From the NOTES section of strtol(3): "Since strtol() can legitimately return 0, LONG_MAX, or LONG_MIN (LLONG_MAX or LLONG_MIN for strtoll()) on both success and failure, the calling program should set errno to 0 before the call, and then determine if an error occurred by checking whether errno has a non-zero value after the call."
Diffstat (limited to 'isys/isys.c')
-rw-r--r--isys/isys.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/isys/isys.c b/isys/isys.c
index e2b40cb87..31786df1e 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -547,7 +547,8 @@ static PyObject * doConfigNetDevice(PyObject * s, PyObject * args) {
if (inet_pton(AF_INET6, ipv6, &addr6) >= 1) {
cfg.ipv6 = ip_addr_in6(&addr6);
- if (strlen(prefix))
+ if (strlen(prefix)) {
+ errno = 0;
i = strtol(prefix, NULL, 10);
if ((errno == ERANGE && (i == LONG_MIN || i == LONG_MAX)) ||
@@ -555,8 +556,10 @@ static PyObject * doConfigNetDevice(PyObject * s, PyObject * args) {
return NULL;
}
- if (i > 0 && i <= 128)
+ if (i > 0 && i <= 128) {
cfg.ipv6_prefixlen = i;
+ }
+ }
}
/* Global */