cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Segmentation fault in SCO Unixware with libcurl,why?

From: 黄志军 <hzhijun_at_huawei.com>
Date: Fri, 22 Oct 2004 15:57:25 +0800

----- Original Message -----
From: "Dan Fandrich" <dan_at_coneharvesters.com>
To: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Thursday, October 21, 2004 10:26 PM
Subject: Re: Segmentation fault in SCO Unixware with libcurl,why?

> On Thu, Oct 21, 2004 at 11:28:14AM +0200, Daniel Stenberg wrote:
> > On Thu, 21 Oct 2004, [utf-8] ??? wrote:
> > >I tried build in root user and surprising to see that it works fine.But if
> > >i build in a specified user, it will not work.
> >
> > To me that indicate some kind of system problem in your end.
>
> It sounds like it might be a library or compiler mismatch somehow. Try
> making sure all the libraries in use by your program are compiled with the
> same compiler, and that the correct libraries are being loaded at run-time.
> If it works as root, perhaps some library can't be loaded by other users
> due to permissions, so a different (an incorrect) one is used in those
> cases.

i only keep one copy of libcurl libray, so i am sure both my program the the test program
will load the same library in run-time.

just now i use gdb to debug my program and the test. Both of them run the same except
after the connect() function is called. My program returns errno = 22(Invalid argument)
and the test return errno is 150(which is correct in debuging i think). Why??

Below is part of the compared info between them(i have saved the total debug information,
if anyone think the following is not enough, i will present more later)

****************my program****************************
singleipconnect (conn=0x8138930, ai=0x812a6a8, timeout_ms=300000, connected=0xbfa41b13 "") at connect.c:618
618 rc = connect(sockfd, ai->ai_addr, ai->ai_addrlen);
(gdb) print *ai
$52 = {ai_flags = 0, ai_family = 2, ai_socktype = 2, ai_protocol = 0, ai_addrlen = 16, ai_addr = 0x812a6c8,
  ai_canonname = 0x0, ai_next = 0x0}
(gdb) s
connect (__a1=8, __a2=0x812a6c8, __a3=16) at sys/socket.h:507
507 return _xconnect(__NETLIB_VERSION__, __a1, __a2, __a3);
(gdb) s
508 }
(gdb) s
singleipconnect (conn=0x8138930, ai=0x812a6a8, timeout_ms=300000, connected=0xbfa41b13 "") at connect.c:620
620 if(-1 == rc) {
(gdb) print rc
$53 = -1
(gdb) n
621 error = Curl_ourerrno();
(gdb) s
Curl_ourerrno () at connect.c:121
121 return errno;
(gdb) print errno
$54 = 22

*****************************the test program *******************************************
singleipconnect (conn=0x80e6268, ai=0x80d8048, timeout_ms=300000, connected=0x7ffff3e7 "") at connect.c:618
618 rc = connect(sockfd, ai->ai_addr, ai->ai_addrlen);
(gdb) print *ai
$48 = {ai_flags = 0, ai_family = 2, ai_socktype = 2, ai_protocol = 0, ai_addrlen = 16, ai_addr = 0x80d8068,
  ai_canonname = 0x0, ai_next = 0x0}
(gdb) s
connect (__a1=3, __a2=0x80d8068, __a3=16) at sys/socket.h:507
507 return _xconnect(__NETLIB_VERSION__, __a1, __a2, __a3);
(gdb) s
508 }
(gdb) s
singleipconnect (conn=0x80e6268, ai=0x80d8048, timeout_ms=300000, connected=0x7ffff3e7 "") at connect.c:620
620 if(-1 == rc) {
(gdb) print rc
$49 = -1
(gdb) n
621 error = Curl_ourerrno();
(gdb) s
Curl_ourerrno () at connect.c:121
121 return errno;
(gdb) print errno
$50 = 150

>
> >>> Dan
> --
> http://www.MoveAnnouncer.com The web change of address service
> Let webmasters know that your web site has moved
Received on 2004-10-22