Dear Sir,

On Fri, Mar 28, 2003 at 04:40:43PM -0600, Burton M. Strauss III wrote:
> Well, if it's erroring vs. eof...
> 

I think you picked it.

> This extract from man fgets:

> 
>      The function fgets() may also fail and set errno for any of the errors
>      specified for the routines fflush(3), fstat(2), read(2), or malloc(3).
> 
>      The function gets() may also fail and set errno for any of the errors
>      specified for the routine getchar(3).
> 
> 
> Stanley, try dumping a test and trace into the lines in initialize.c @ 245
> (remember to add the {} too).  Make it look like this:
> 
>         if (fgets(buff, sizeof(buff), fd)==NULL) {
>           if (errno != 0) {
>               traceEvent(CONST_TRACE_ERROR, "IP2CC: error reading file,
> %s(%d).",
>                          strerror(errno), errno);
>               traceEvent(CONST_TRACE_INFO, "IP2CC: ntop continues OK, but
> with partial file");
>               break;
>           }
>           continue;
>         }
> 
> (I **THINK** that will compile ok)
> 

Yep.

tsper> diff -u3 initialize.c.orig initialize.c
--- initialize.c.orig   Sat Mar 29 06:55:07 2003
+++ initialize.c        Sat Mar 29 06:57:14 2003
@@ -242,8 +242,14 @@
         char buff[256];
         char *strtokState, *cc, *ip, *prefix;
 
-        if (fgets(buff, sizeof(buff), fd)==NULL)
+        if (fgets(buff, sizeof(buff), fd)==NULL) {
+          if (errno != 0) {
+              traceEvent(CONST_TRACE_ERROR, "IP2CC: error reading file,
%s(%d).", strerror(errno), errno);
+              traceEvent(CONST_TRACE_INFO, "IP2CC: ntop continues OK,
but with partial file");
+              break;
+          }
           continue;
+        }
 
         if ((cc=strtok_r(buff, ":", &strtokState))==NULL)
           continue;
tsper> 

>From the log after starting from the console,

Mar 29 06:59:12 tsper ntop[95185]: I18N: This instance of ntop does not
support multiple languages 
Mar 29 06:59:12 tsper ntop[95185]: IP2CC: Looking for IP address <->
Country code mapping file 
Mar 29 06:59:13 tsper ntop[95185]: **ERROR** IP2CC: error reading file,
No such file or directory(2).
Mar 29 06:59:13 tsper ntop[95185]: IP2CC: ntop continues OK, but with
partial file

But there doesn't seem to be any difference between the problem
installation (tsper) and a good one (tssyd).

tsitc> ssh tssyd ll /usr/local/ntop/etc/ntop
total 904
-rw-r--r--  1 anwsmh  anwsmh   57336 Feb  4 21:03 etter.passive.os.fp
-rw-r--r--  1 anwsmh  anwsmh    1977 Jan  2  2002 ntop-cert.pem
-rwxr-xr-x  1 anwsmh  anwsmh    2811 Mar  7 07:25 oui.txt
-rw-r--r--  1 anwsmh  anwsmh  845404 Jan 31 01:34 p2c.opt.table
-rwxr-xr-x  1 anwsmh  anwsmh    2998 Mar  7 07:25 specialMAC.txt
tsitc> ssh tsper ll /usr/local/ntop/etc/ntop
total 904
-rw-r--r--  1 anwsmh  anwsmh   57336 Feb  4 18:03 etter.passive.os.fp
-rw-r--r--  1 anwsmh  anwsmh    1977 Jan  2  2002 ntop-cert.pem
-rwxr-xr-x  1 anwsmh  anwsmh    2811 Mar  7 04:25 oui.txt
-rw-r--r--  1 anwsmh  anwsmh  845404 Jan 30 22:34 p2c.opt.table
-rwxr-xr-x  1 anwsmh  anwsmh    2998 Mar  7 04:25 specialMAC.txt
tsitc> 

Thank you,

Yours sincerely.

-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.
_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop

Reply via email to