fix fhostcmd with numeric address

This commit is contained in:
hsn 2006-09-17 07:20:41 +00:00
parent d4a31321ad
commit 8608e23e8f
2 changed files with 5 additions and 7 deletions

View File

@ -18,6 +18,7 @@ Version NEXT
fsetup command added to setup.csh fsetup command added to setup.csh
fcd: remove trailing \r\n from readme file fcd: remove trailing \r\n from readme file
fcd: do not print empty line after directory protection fcd: do not print empty line after directory protection
fsetupcmd: don't crash if called with numeric address
Version 2.8.1b24 - 19 Feb 2005 Version 2.8.1b24 - 19 Feb 2005
use getopt from stdio.h instead of getopt.h in fspscan.c use getopt from stdio.h instead of getopt.h in fspscan.c

View File

@ -18,6 +18,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#ifdef HOST_LOOKUP #ifdef HOST_LOOKUP
#include <netdb.h> #include <netdb.h>
#endif #endif
@ -141,13 +142,8 @@ int print_host_setup(struct fsp_host *setup,int csh,int lhost)
#endif #endif
if (!setup->hostname) lhost=NUMBER; if (!setup->hostname) lhost=NUMBER;
} }
if ( if ((lhost==NUMBER || lhost==0) && !setup->hostaddr) {
(lhost==NUMBER && !setup->hostaddr) /* look for IP number */
#if HOST_LOOKUP
|| lhost==0
#endif
) {
/* look for number */
#if HOST_LOOKUP #if HOST_LOOKUP
if ( (hp=gethostbyname(setup->hostname))) if ( (hp=gethostbyname(setup->hostname)))
setup->hostaddr=(char *)inet_ntoa(*(struct in_addr *) * hp->h_addr_list); setup->hostaddr=(char *)inet_ntoa(*(struct in_addr *) * hp->h_addr_list);
@ -162,6 +158,7 @@ int print_host_setup(struct fsp_host *setup,int csh,int lhost)
else else
if(setup->hostname) if(setup->hostname)
lhost=NAME; lhost=NAME;
assert(lhost != 0 );
} else } else
{ {
if (lhost==NUMBER && !setup->hostaddr) if (lhost==NUMBER && !setup->hostaddr)