diff options
author | jkh <jkh@FreeBSD.org> | 2000-08-03 02:51:45 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-08-03 02:51:45 +0000 |
commit | fae2a8c58e4da2a460b45eb070fe64678870e427 (patch) | |
tree | c132d1d399e81b740f61a445cb841b42ab7c5421 /release/sysinstall/media.c | |
parent | db236d95a5a67c9e9f03e52a0c14861c7d685154 (diff) | |
download | FreeBSD-src-fae2a8c58e4da2a460b45eb070fe64678870e427.zip FreeBSD-src-fae2a8c58e4da2a460b45eb070fe64678870e427.tar.gz |
Fix HTTP port addresses for the IPv6 case.
Submitted by: pho and Hajimu UMEMOTO
Diffstat (limited to 'release/sysinstall/media.c')
-rw-r--r-- | release/sysinstall/media.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c index 022754a..305fb79 100644 --- a/release/sysinstall/media.c +++ b/release/sysinstall/media.c @@ -453,7 +453,7 @@ mediaSetFTPPassive(dialogMenuItem *self) int mediaSetHTTP(dialogMenuItem *self) { int result; - char *cp, hbuf[MAXHOSTNAMELEN], *hostname, *var_hostname; + char *cp, *idx, hbuf[MAXHOSTNAMELEN], *hostname, *var_hostname; int HttpPort; int what = DITEM_RESTORE; @@ -474,17 +474,18 @@ int mediaSetHTTP(dialogMenuItem *self) return DITEM_FAILURE; SAFE_STRCPY(hbuf, cp); hostname = hbuf; - if (*hostname == '[' && (cp = index(hostname + 1, ']')) != NULL) { + if (*hostname == '[' && (idx = index(hostname + 1, ']')) != NULL && + (*++idx == '\0' || *idx == ':')) { ++hostname; - *cp = '\0'; - } - cp = index(hostname, ':'); - if (cp != NULL && *cp == ':') { - *(cp++) = '\0'; - HttpPort = strtol(cp, 0, 0); + *(idx - 1) = '\0'; + } else + idx = index(hostname, ':'); + if (idx == NULL || *idx != ':') + HttpPort = 3128; /* try this as default */ + else { + *(idx++) = '\0'; + HttpPort = strtol(idx, 0, 0); } - else - HttpPort = 3128; variable_set2(VAR_HTTP_HOST, hostname, 0); variable_set2(VAR_HTTP_PORT, itoa(HttpPort), 0); @@ -501,7 +502,8 @@ int mediaSetHTTP(dialogMenuItem *self) mediaDevice->shutdown = dummyShutdown; return DITEM_SUCCESS | DITEM_LEAVE_MENU | what; } - + + int mediaSetUFS(dialogMenuItem *self) { |