bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incorrect code in hurd/nfs/mount.c?


From: Hong ZHANG
Subject: Incorrect code in hurd/nfs/mount.c?
Date: Sun, 24 Nov 2002 15:33:37 -0800 (PST)

Hi:
    Please correct me if I got this wrong.
    But would the following piece of code wrong?
    By looking at lines 39 and 120, is line 120 code not correct?
    Or maybe hurd is using different <netdb.h> than what Gnu/Linux is
using? Please enlighten me if this is the case.


excerpt from hurd/nfs/mount.c:
-------------------------------------------------------------------
     38 /* Service name for portmapper */
     39 char *pmap_service_name = "sunrpc";


    109   /* Lookup the portmapper port number */
    110   if (pmap_service_name)
    111     {
    112       struct servent *s;
    113
    114       /* XXX This will always fail! pmap_service_name will always
be "sunrpc"
    115          What should pmap_service_name really be?  By definition
the second
    116      argument is either "tcp" or "udp"  Thus, is this backwards
    117      (as service_name suggests)?  If so, should it read:
    118              s = getservbyname (pmap_service_name, "udp");
    119          or is there something I am missing here?  */
    120       s = getservbyname ("sunrpc", pmap_service_name);
    121       if (s)
    122     pmapport = s->s_port;
    123       else
    124     pmapport = htons (pmap_service_number);
    125     }
    126   else
    127     pmapport = htons (pmap_service_number);


excerpt from getservbyname manpage (on Redhat Linux 7.2):
-----------------------------------------------------------------
       struct servent *getservbyname(const char *name, const char *proto);


       The  getservbyname()  function returns a servent structure
       for the line from /etc/services that matches  the  service
       name  using protocol proto. If proto is NULL, any protocol
       will be matched.



Sincerely
Hong Zhang
==========================================================
Every day has a tommorrow as long as there's no Big Bang.
==========================================================





reply via email to

[Prev in Thread] Current Thread [Next in Thread]