Make useage of hostname global variable consistent.

PR: 4135
Based on submitted patch by:	 blank@fox.uni-trier.de
This commit is contained in:
David Nugent 1997-07-24 09:26:12 +00:00
parent 2487a449d3
commit 0512556a48
2 changed files with 8 additions and 7 deletions

View file

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ftpcmd.y 8.3 (Berkeley) 4/6/94
* $Id$
* $Id: ftpcmd.y,v 1.10 1997/02/22 14:21:27 peter Exp $
*/
/*
@ -80,7 +80,8 @@ extern int debug;
extern int timeout;
extern int maxtimeout;
extern int pdata;
extern char hostname[], remotehost[];
extern char *hostname;
extern char remotehost[];
extern char proctitle[];
extern int usedefault;
extern int transflag;

View file

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ftpd.c,v 1.39 1997/05/10 18:58:15 davidn Exp $
* $Id: ftpd.c,v 1.40 1997/05/21 23:24:41 danny Exp $
*/
#if 0
@ -151,8 +151,8 @@ off_t byte_count;
#endif
int defumask = CMASK; /* default umask value */
char tmpline[7];
#ifdef VIRTUAL_HOSTING
char *hostname;
#ifdef VIRTUAL_HOSTING
char *ftpuser;
static struct ftphost {
@ -165,8 +165,6 @@ static struct ftphost {
char *loginmsg;
} *thishost, *firsthost;
#else
char hostname[MAXHOSTNAMELEN];
#endif
char remotehost[MAXHOSTNAMELEN];
char *ident = NULL;
@ -535,7 +533,9 @@ main(argc, argv, envp)
/* reply(220,) must follow */
}
#ifndef VIRTUAL_HOSTING
(void) gethostname(hostname, sizeof(hostname));
if ((hostname = malloc(MAXHOSTNAMELEN)) == NULL)
fatal("Ran out of memory.");
(void) gethostname(hostname, MAXHOSTNAMELEN);
#endif
reply(220, "%s FTP server (%s) ready.", hostname, version);
(void) setjmp(errcatch);