diff options
author | jkh <jkh@FreeBSD.org> | 2000-07-30 22:18:53 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-07-30 22:18:53 +0000 |
commit | 8c276cfb441f34f53b90bc07b1390842757d0435 (patch) | |
tree | e3912ed72daf295bf30a4796dbb6cbb5fdfcd391 /release/sysinstall | |
parent | 0c173f44b34991f342b56f952cf263d57dfdd13c (diff) | |
download | FreeBSD-src-8c276cfb441f34f53b90bc07b1390842757d0435.zip FreeBSD-src-8c276cfb441f34f53b90bc07b1390842757d0435.tar.gz |
Fix the HTTP transfer code to correctly parse the port number if
specified.
Submitted by: pho
Diffstat (limited to 'release/sysinstall')
-rw-r--r-- | release/sysinstall/media.c | 29 | ||||
-rw-r--r-- | release/sysinstall/variable.c | 6 |
2 files changed, 18 insertions, 17 deletions
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c index 320efc2..022754a 100644 --- a/release/sysinstall/media.c +++ b/release/sysinstall/media.c @@ -453,15 +453,16 @@ mediaSetFTPPassive(dialogMenuItem *self) int mediaSetHTTP(dialogMenuItem *self) { int result; - char *cp, *idx, hbuf[MAXHOSTNAMELEN], *hostname, *var_hostname; + char *cp, hbuf[MAXHOSTNAMELEN], *hostname, *var_hostname; int HttpPort; int what = DITEM_RESTORE; - var_hostname=variable_get(VAR_NAMESERVER); + var_hostname = variable_get(VAR_NAMESERVER); variable_unset(VAR_NAMESERVER); result = mediaSetFTP(self); - variable_set2(VAR_NAMESERVER, var_hostname, 0); + if (var_hostname) + variable_set2(VAR_NAMESERVER, var_hostname, 0); if (DITEM_STATUS(result) != DITEM_SUCCESS) return result; @@ -473,18 +474,17 @@ int mediaSetHTTP(dialogMenuItem *self) return DITEM_FAILURE; SAFE_STRCPY(hbuf, cp); hostname = hbuf; - if (*hostname == '[' && (idx = index(hostname + 1, ']')) != NULL && - (*++idx == '\0' || *idx == ':')) { + if (*hostname == '[' && (cp = index(hostname + 1, ']')) != NULL) { ++hostname; - *(idx - 1) = '\0'; - } else - idx = index(hostname, ':'); - if (idx == NULL || *cp != ':') - HttpPort = 3128; /* try this as default */ - else { - *(idx++) = '\0'; - HttpPort = strtol(idx, 0, 0); + *cp = '\0'; + } + cp = index(hostname, ':'); + if (cp != NULL && *cp == ':') { + *(cp++) = '\0'; + HttpPort = strtol(cp, 0, 0); } + else + HttpPort = 3128; variable_set2(VAR_HTTP_HOST, hostname, 0); variable_set2(VAR_HTTP_PORT, itoa(HttpPort), 0); @@ -501,8 +501,7 @@ int mediaSetHTTP(dialogMenuItem *self) mediaDevice->shutdown = dummyShutdown; return DITEM_SUCCESS | DITEM_LEAVE_MENU | what; } - - + int mediaSetUFS(dialogMenuItem *self) { diff --git a/release/sysinstall/variable.c b/release/sysinstall/variable.c index bae7bc2..86429cd 100644 --- a/release/sysinstall/variable.c +++ b/release/sysinstall/variable.c @@ -96,9 +96,11 @@ void variable_set2(char *var, char *value, int dirty) { if (!var || !value) - msgFatal("Null name or value passed to set_variable2!"); + msgFatal("Null name or value passed to set_variable2(%s) = %s!", + var ? var : "", value ? value : ""); else if (!*var || !*value) - msgDebug("Warning: Zero length name or value passed to variable_set2()\n"); + msgDebug("Warning: Zero length name or value passed to variable_set2(%s) = %s\n", + var, value); make_variable(var, value, dirty); } |