Skip to content

Commit

Permalink
Fixed the bug with the host names. after ..., y, z the hostnames were…
Browse files Browse the repository at this point in the history
… jumping to

ba, bb ... skipping aa, ab ....

Also found another bug. The counter for the hostnames was int which has a
maximum value of approx. 2.1 billion while the host names are allowed to go upto
approx. 209 billion. Changed the counter to llong.
  • Loading branch information
alakhian committed Jul 26, 2002
1 parent 5cd6ef4 commit 32737a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions plotter.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ plotter_makemore(void)

char *
HostLetter(
unsigned ix)
llong ix)
{
static char name[MAX_HOSTLETTER_LEN+1];
static char *pname;
Expand All @@ -203,8 +203,8 @@ HostLetter(
while (pname >= name) {
unsigned digit = ix % 26;
*pname-- = 'a'+digit;
ix = ix / 26;
if (ix == 0)
ix = (ix / 26) - 1;
if (ix == -1)
return(pname+1);
}
fprintf(stderr,"Fatal, too many hosts to name (max length %d)\n\nNOTE:\nIf you are using gcc version 2.95.3, then this may be a compiler bug. This particular version\nis known to generate incorrect assembly code when used with CCOPT=-O2.\nSuggested fixes are:\n 1. Update gcc to the latest version and recompile tcptrace.\n 2. Use the same version of gcc, but edit the tcptrace Makefile, setting CCOPT=-O instead of\n CCOPT=-O2, and then recompile tcptrace.\nEither of these steps should hopefully fix the problem.\n\n", MAX_HOSTLETTER_LEN);
Expand All @@ -216,7 +216,7 @@ HostLetter(
char *
NextHostLetter(void)
{
static int count = 0;
static llong count = 0;
return(HostLetter(count++));
}

Expand Down
2 changes: 1 addition & 1 deletion tcptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ char *ts2ascii_date(timeval *);
char *ServiceName(portnum);
char *HostName(ipaddr);
char *HostAddr(ipaddr);
char *HostLetter(u_int);
char *HostLetter(llong);
char *NextHostLetter(void);
char *EndpointName(ipaddr,portnum);
PLOTTER new_plotter(tcb *plast, char *filename, char *title,
Expand Down

0 comments on commit 32737a3

Please sign in to comment.