diff options
author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1997-03-11 16:44:00 +0000 |
---|---|---|
committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1997-03-11 16:44:00 +0000 |
commit | 06ffcdb20220c8d5ca54e79ff86140f6f12bcc93 (patch) | |
tree | 4516625783e6e7975450b1fd8506d85cd7a774bf /usr.sbin/sysinstall/media.c | |
parent | 4b3d276343600c469fee6d20e8bb9e2386125dda (diff) | |
download | src-06ffcdb20220c8d5ca54e79ff86140f6f12bcc93.tar.gz src-06ffcdb20220c8d5ca54e79ff86140f6f12bcc93.zip |
YAMF22
Notes
Notes:
svn path=/head/; revision=23723
Diffstat (limited to 'usr.sbin/sysinstall/media.c')
-rw-r--r-- | usr.sbin/sysinstall/media.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 3b0f231219f9..23284391fe8d 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: media.c,v 1.80 1997/02/22 14:11:57 peter Exp $ + * $Id: media.c,v 1.81 1997/03/07 16:39:20 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -287,7 +287,7 @@ int mediaSetFTP(dialogMenuItem *self) { static Device ftpDevice; - char *cp, *hostname, *dir; + char *cp, hostname[MAXHOSTNAMELEN], *dir; extern int FtpPort; static Device *networkDev = NULL; int what = DITEM_RESTORE; @@ -329,6 +329,7 @@ mediaSetFTP(dialogMenuItem *self) return DITEM_FAILURE | what; } SAFE_STRCPY(ftpDevice.name, cp); + SAFE_STRCPY(hostname, cp + 6); dialog_clear_norefresh(); if (!networkDev || msgYesNo("You've already done the network configuration once,\n" @@ -346,7 +347,6 @@ mediaSetFTP(dialogMenuItem *self) variable_unset(VAR_FTP_PATH); return DITEM_FAILURE | what; } - hostname = cp + 6; if ((cp = index(hostname, ':')) != NULL) { *(cp++) = '\0'; FtpPort = strtol(cp, 0, 0); @@ -361,7 +361,7 @@ mediaSetFTP(dialogMenuItem *self) msgDebug("port # = `%d'\n", FtpPort); } if (variable_get(VAR_NAMESERVER)) { - if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) { + if ((inet_addr(hostname) == INADDR_NONE) && (gethostbyname(hostname) == NULL)) { msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n" "name server, gateway and network interface are correctly configured?", hostname); if (networkDev) @@ -427,7 +427,7 @@ mediaSetNFS(dialogMenuItem *self) static Device nfsDevice; static Device *networkDev = NULL; char *cp, *idx; - + char hostname[MAXHOSTNAMELEN]; mediaClose(); dialog_clear_norefresh(); cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n" @@ -435,12 +435,13 @@ mediaSetNFS(dialogMenuItem *self) "This should be in the format: hostname:/some/freebsd/dir"); if (!cp) return DITEM_FAILURE; - if (!(idx = index(cp, ':'))) { + SAFE_STRCPY(hostname, cp); + if (!(idx = index(hostname, ':'))) { msgConfirm("Invalid NFS path specification. Must be of the form:\n" "host:/full/pathname/to/FreeBSD/distdir"); return DITEM_FAILURE; } - SAFE_STRCPY(nfsDevice.name, cp); + SAFE_STRCPY(nfsDevice.name, hostname); *idx = '\0'; if (!networkDev || msgYesNo("You've already done the network configuration once,\n" "would you like to skip over it now?") != 0) { @@ -454,9 +455,9 @@ mediaSetNFS(dialogMenuItem *self) msgDebug("mediaSetNFS: Net device init failed\n"); } if (variable_get(VAR_NAMESERVER)) { - if ((gethostbyname(cp) == NULL) && (inet_addr(cp) == INADDR_NONE)) { + if ((inet_addr(hostname) == INADDR_NONE) && (gethostbyname(hostname) == NULL)) { msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n" - "name server, gateway and network interface are correctly configured?", cp); + "name server, gateway and network interface are correctly configured?", hostname); if (networkDev) networkDev->shutdown(networkDev); networkDev = NULL; @@ -464,9 +465,9 @@ mediaSetNFS(dialogMenuItem *self) return DITEM_FAILURE; } else - msgDebug("Found DNS entry for %s successfully..", cp); + msgDebug("Found DNS entry for %s successfully..", hostname); } - variable_set2(VAR_NFS_HOST, cp); + variable_set2(VAR_NFS_HOST, hostname); nfsDevice.type = DEVICE_TYPE_NFS; nfsDevice.init = mediaInitNFS; nfsDevice.get = mediaGetNFS; |