Bug in nl-socket.c?

For the Compleat Fan
Locked
pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Bug in nl-socket.c?

Post by pjot »

Lutz,

Today I tested some network stuff on Tru64Unix. The following happened:
peter> su
Password:
# ./newlisp
newLISP v.8.8.8 on Tru64Unix, execute 'newlisp -h' for more info.

> (net-ping "127.0.0.1")
nil
> (net-error)
(2 "ERR: Host name not known")
> (exit)
# exit
Weird! The IP address '127.0.0.1' is mentioned in the /etc/hosts file, it should work without a problem. Then I checked your file 'nl-socket.c' and at line 1566 I see the following:

Code: Select all

   1565 
   1566     if((whereto.sin_addr.s_addr = inet_addr(hostaddr)) == (unsigned)-1);
   1567       {
   1568       if(!(hp = gethostbyname(hostaddr)))
   1569         {
   1570         shutdown(s, SHUT_RDWR);
   1571         return(netError(ERR_INET_HOST_UNKNOWN));
   1572         }
   1573       whereto.sin_family = hp->h_addrtype;
   1574       memcpy((void *)&whereto.sin_addr, hp->h_addr, hp->h_length);
   1575       }
   1576 
Look at the SEMI-COLON at the end of line 1566. The whole IF-clause is skipped now. If I remove the semi-colon and recompile, things work:
peter> su
Password:
# ./newlisp
newLISP v.8.8.8 on Tru64Unix, execute 'newlisp -h' for more info.

> (net-ping "127.0.0.1")
("127.0.0.1")
> (exit)
#

So, shouldn't the semi-colon be removed from line 1566?

Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

oops, thanks

Lutz

Locked