- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: gethostbyname dumps with SIGSEGV
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 11:53 AM
тАО12-04-2007 11:53 AM
gethostbyname dumps with SIGSEGV
The HP-UX port gets SIGSEGV in gethostbyname the second time the function containing it is called.
I'm compiling -Aa -D_HPUX_SOURCE -D_POSIX_SOURCE, linking dynamically, and the program is not threaded.
Any clues where to look?
- Tags:
- gethostbyname
- SIGSEGV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 12:02 PM
тАО12-04-2007 12:02 PM
Re: gethostbyname dumps with SIGSEGV
Verify your arrays are sized correctly and that your pointers are valid.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 12:13 PM
тАО12-04-2007 12:13 PM
Re: gethostbyname dumps with SIGSEGV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 01:03 PM
тАО12-04-2007 01:03 PM
Re: gethostbyname dumps with SIGSEGV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 01:38 PM
тАО12-04-2007 01:38 PM
Re: gethostbyname dumps with SIGSEGV
static
int resolv_hostname( const char *hname,struct sockaddr_in *sin ){
struct hostent *hostp = NULL;
unsigned long addr;
addr = inet_addr( hname );
if (addr != (in_addr_t)-1)
memcpy( &sin->sin_addr, &addr, sizeof( addr ));
else {
hostp = gethostbyname( hname );
if( hostp == NULL )
return -1;
else
memcpy( &sin->sin_addr, hostp->h_addr_list[0], hostp->h_length );
}
return 0;
}
It SIGSEGV's in the gethostbyname call.
The WDB stack says:
strlen+0xc
nss_search+0x114
__getghostbyname+0x140
gethostbyname+0x94
all from /usr/lib/libc.2
The hname variable is valid and contains a valid hostname string.
Copying the hname value to a big temporary buffer string makes no difference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 02:17 PM
тАО12-04-2007 02:17 PM
Re: gethostbyname dumps with SIGSEGV
change... unsigned long addr;
to... struct in_addr addr;
if ((addr = inet_addr(hname)) == -1)
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 03:18 PM
тАО12-04-2007 03:18 PM
Re: gethostbyname dumps with SIGSEGV
I changed it to in_addr_t and it made no difference.
FWIW, the Linux and Solaris ports run just fine and according to all the tools the other OS's have no memory issues.
That leads me to think it is some some include, define, compile switch, or library issue with the HP-UX port.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 07:53 PM
тАО12-04-2007 07:53 PM
Re: gethostbyname dumps with SIGSEGV
~thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 08:12 PM
тАО12-04-2007 08:12 PM
Re: gethostbyname dumps with SIGSEGV
> if ((addr = inet_addr(hname)) == -1)
when I meant...
if ((addr.s_addr = inet_addr(hname)) == -1)
where s_addr is a member of the in_addr structure and is of type in_addr_t.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 08:23 PM
тАО12-04-2007 08:23 PM
Re: gethostbyname dumps with SIGSEGV
Right.
I had to use in_addr_t so it would work in 64 bit mode.