Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Glibc problems
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
genlee
n00b
n00b


Joined: 16 Apr 2003
Posts: 2

PostPosted: Wed Apr 16, 2003 1:44 am    Post subject: Glibc problems Reply with quote

When calling getservbyname(), it alwys returns NULL. I have checked /etc/services and it is good. I also tried reinstalling glibc but it didn't help at all. Because of this, a lot of my services will not work now. Anyone know why?

Here is a little test I ran:
Code:
vortex root # cat blah.c
#include <stdio.h>
#include <netdb.h>
int
main(int argc, char **argv) {
       struct servent *se;
       se = getservbyname(argv[1], argv[2]);
       printf("%s\n", se->s_name);
       return 0;
}

vortex root # ltrace ./a.out smtp tcp
__libc_start_main(0x08048378, 3, 0xbd6539b4, 0x080483d0, 0x08048400 <unfinished
...>
getservbyname("smtp", "tcp")                      = NULL
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

vortex root # grep smtp /etc/services
smtp            25/tcp          mail
ssmtp           465/tcp                         # SMTP over SSL

Back to top
View user's profile Send private message
cerri
Bodhisattva
Bodhisattva


Joined: 05 Mar 2003
Posts: 2957
Location: # init S

PostPosted: Wed Apr 16, 2003 4:10 am    Post subject: Reply with quote

Code:
open("/etc/services", O_RDONLY)         = 3
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=13521, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40
015000
read(3, "# /etc/services:\n# $Id: services"..., 4096) = 4096
close(3)                                = 0
munmap(0x40015000, 4096)                = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40
015000
write(1, "smtp\n", 5smtp
)                   = 5
munmap(0x40015000, 4096)                = 0
_exit(0)                                = ?


It works for me :roll:
_________________
Enjoy your freedom.
Sex is like hacking. You get in, you get out, and you hope you didnt leave something behind that can be traced back to you.
<----------------------->
Andrea Cerrito
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum