Bug in nl-socket.c?

Started by pjot, May 31, 2006, 12:40:57 PM

Previous topic - Next topic

pjot

Lutz,



Today I tested some network stuff on Tru64Unix. The following happened:
Quote
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:



  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:


Quote
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

#1
oops, thanks



Lutz