lkml.org 
[lkml]   [1996]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: getservbyport (fwd)
From: Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at>
[...]
> > Use:
> >
> > if ((serv = getservbyport(htons(23), "tcp")) == NULL) {
> ^^^^^^^^^
>
> this parameter is not "short", it's an int ! time to the RTfineManual...

The value passed to getservbyport is compared with another integer
(s_port in struct servent), which ist set to `ntohs(something)'.
In case of telnet, this is ntohs(23) == 0x1700. The value of
htonl(23) is 0x17000000 which is *wrong*.

Michael.
--
Michael "Tired" Riepe <riepe@ifwsn4.ifw.uni-hannover.de>
"Beware the storm that gathers here!" (The Prophet's Song)


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.019 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site