summaryrefslogtreecommitdiffstats
path: root/loader2/urls.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 /loader2/urls.c
parentadfa32b7ae12e10545c927f71655aaef950013a0 (diff)
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 'loader2/urls.c')
-rw-r--r--loader2/urls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/loader2/urls.c b/loader2/urls.c
index f95c75dcc..8dd81bc2a 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -180,6 +180,7 @@ int urlinstStartTransfer(struct iurlinfo * ui, char *path,
if (portstr == NULL) {
port = -1;
} else {
+ errno = 0;
port = strtol(portstr, NULL, 10);
if ((errno == ERANGE && (port == LONG_MIN || port == LONG_MAX)) ||