This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: gethostbyname() crashes
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 4 Aug 2004 15:31:27 -0400
- Subject: Re: gethostbyname() crashes
- References: <usmb2zyt5.fsf@gnu.org> <cerdcb$100$1@sea.gmane.org>
- Reply-to: cygwin at cygwin dot com
On Wed, Aug 04, 2004 at 02:28:10PM -0500, Pawel Slusarz wrote:
>"Sam Steingold" <sds@gnu.org> wrote in message
>usmb2zyt5.fsf@gnu.org">news:usmb2zyt5.fsf@gnu.org...
>> CYGWIN_NT-5.0 1.5.10(0.116/4/2) 2004-05-25 22:07 i686
>>
>> (gdb) p gethostbyname("ftp.gnu.org")
>
>
>I get the same. Maybe a bug that was introduced recently?
>
>(gdb) list
>1 #include <stdio.h>
>2 #include <netdb.h>
>3
>4 int main(int argc, char *argv[])
>5 {
>6 char name[] = "localhost\0";
>7 gethostbyname(name);
>8 printf("Hello, world\n");
>9
>10 return 0;
>(gdb) break 7
>Breakpoint 1 at 0x4010bc: file test.c, line 7.
>(gdb) run
>Starting program: /cygdrive/c/shared/test/a.exe
>
>Breakpoint 1, main (argc=1, argv=0xa0521d0) at test.c:7
>7 gethostbyname(name);
>(gdb) step
>
>Program received signal SIGSEGV, Segmentation fault.
>0x7c5746b9 in KERNEL32!IsBadWritePtr ()
> from /cygdrive/c/WINNT/system32/KERNEL32.DLL
Nope. Not a bug. Search the archives for IsBadWritePtr. I'm sure it
will be instructive.
Try actually running the program, and you're see "Hello World".
cgf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/