From 8608e23e8f2faa8547f6e6c7e9c873190fc40ca6 Mon Sep 17 00:00:00 2001 From: hsn <> Date: Sun, 17 Sep 2006 07:20:41 +0000 Subject: [PATCH] fix fhostcmd with numeric address --- ChangeLog | 1 + clients/fhost.c | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5301181..ef783d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ Version NEXT fsetup command added to setup.csh fcd: remove trailing \r\n from readme file 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 use getopt from stdio.h instead of getopt.h in fspscan.c diff --git a/clients/fhost.c b/clients/fhost.c index 55a5999..72acd52 100644 --- a/clients/fhost.c +++ b/clients/fhost.c @@ -18,6 +18,7 @@ #include #endif #include +#include #ifdef HOST_LOOKUP #include #endif @@ -141,13 +142,8 @@ int print_host_setup(struct fsp_host *setup,int csh,int lhost) #endif if (!setup->hostname) lhost=NUMBER; } - if ( - (lhost==NUMBER && !setup->hostaddr) -#if HOST_LOOKUP - || lhost==0 -#endif - ) { - /* look for number */ + if ((lhost==NUMBER || lhost==0) && !setup->hostaddr) { + /* look for IP number */ #if HOST_LOOKUP if ( (hp=gethostbyname(setup->hostname))) 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 if(setup->hostname) lhost=NAME; + assert(lhost != 0 ); } else { if (lhost==NUMBER && !setup->hostaddr)