bug-glibc
[Top][All Lists]
Advanced

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

getservent() bug (on linux)


From: Kevin Layer
Subject: getservent() bug (on linux)
Date: Wed, 24 Jul 2002 08:04:17 -0700

   #include <stdio.h>
   #include <netdb.h>

   main()
   {
       struct servent *se;

       setservent(1);
       while ((se = getservent()) != NULL) {
           printf("%s: %d, %s\n", se->s_name, se->s_port, se->s_proto);
       }
       endservent();
   }

% grep tcpmux /etc/services
tcpmux          1/tcp                           # TCP port service multiplexer
tcpmux          1/udp                           # TCP port service multiplexer
% gcc -o foo foo.c
% ./foo | grep tcpmux
tcpmux: 256, tcp
tcpmux: 256, udp
tcpmux: 256, tcp
tcpmux: 256, udp

On FreeBSD it does not have this duplicate behavior.

Is this a known bug?

Kevin



reply via email to

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