summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-01-30 06:38:19 +0000
committerjkh <jkh@FreeBSD.org>1997-01-30 06:38:19 +0000
commit71baeec496d609059f7e6b14bd7cac2919adac98 (patch)
treed412fd5beb09996ea4009b60da2d3af1cc6db72f /release
parent25969ba11923c9f40bc5245574864f786bfeea2b (diff)
downloadFreeBSD-src-71baeec496d609059f7e6b14bd7cac2919adac98.zip
FreeBSD-src-71baeec496d609059f7e6b14bd7cac2919adac98.tar.gz
Sync with RELENG_2_2 changes.
Diffstat (limited to 'release')
-rw-r--r--release/sysinstall/ftp.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/release/sysinstall/ftp.c b/release/sysinstall/ftp.c
index 0cbb53f..3814dc2 100644
--- a/release/sysinstall/ftp.c
+++ b/release/sysinstall/ftp.c
@@ -47,13 +47,34 @@ Boolean ftpInitted = FALSE;
static FILE *OpenConn;
int FtpPort;
+/* Brings up attached network device, if any - takes FTP device as arg */
+static Boolean
+netUp(Device *dev)
+{
+ Device *netdev = (Device *)dev->private;
+
+ if (netdev)
+ return netdev->init(netdev);
+ else
+ return TRUE; /* No net == happy net */
+}
+
+/* Brings down attached network device, if any - takes FTP device as arg */
+static void
+netDown(Device *dev)
+{
+ Device *netdev = (Device *)dev->private;
+
+ if (netdev)
+ netdev->shutdown(netdev);
+}
+
Boolean
mediaInitFTP(Device *dev)
{
int i, code;
char *cp, *rel, *hostname, *dir;
char *user, *login_name, password[80];
- Device *netdev = (Device *)dev->private;
if (ftpInitted)
return TRUE;
@@ -67,7 +88,7 @@ mediaInitFTP(Device *dev)
}
/* If we can't initialize the network, bag it! */
- if (netdev && !netdev->init(netdev))
+ if (!netUp(dev))
return FALSE;
try:
@@ -75,8 +96,7 @@ try:
if (!cp) {
if (DITEM_STATUS(mediaSetFTP(NULL)) == DITEM_FAILURE || (cp = variable_get(VAR_FTP_PATH)) == NULL) {
msgConfirm("Unable to get proper FTP path. FTP media not initialized.");
- if (netdev)
- netdev->shutdown(netdev);
+ netDown(dev);
return FALSE;
}
}
@@ -85,8 +105,7 @@ try:
dir = variable_get(VAR_FTP_DIR);
if (!hostname || !dir) {
msgConfirm("Missing FTP host or directory specification. FTP media not initialized,");
- if (netdev)
- netdev->shutdown(netdev);
+ netDown(dev);
return FALSE;
}
user = variable_get(VAR_FTP_USER);
@@ -145,12 +164,12 @@ try:
return TRUE;
punt:
+ ftpInitted = FALSE;
if (OpenConn != NULL) {
fclose(OpenConn);
OpenConn = NULL;
}
- if (netdev)
- netdev->shutdown(netdev);
+ netDown(dev);
variable_unset(VAR_FTP_PATH);
return FALSE;
}
@@ -177,6 +196,7 @@ mediaGetFTP(Device *dev, char *file, Boolean probe)
variable_unset(VAR_FTP_PATH);
/* If we can't re-initialize, just forget it */
if (!dev->init(dev)) {
+ netDown(dev);
fclose(OpenConn);
OpenConn = NULL;
return NULL;
@@ -216,8 +236,6 @@ mediaGetFTP(Device *dev, char *file, Boolean probe)
void
mediaShutdownFTP(Device *dev)
{
- /* Device *netdev = (Device *)dev->private; */
-
if (!ftpInitted)
return;
@@ -226,6 +244,5 @@ mediaShutdownFTP(Device *dev)
fclose(OpenConn);
OpenConn = NULL;
}
- /* if (netdev) netdev->shutdown(netdev); */
ftpInitted = FALSE;
}
OpenPOWER on IntegriCloud