another GDK segfault...



working on a RH5.1 box w/ all updates:
glibc 2.0.7
glib 1.1.3
glib 1.0.5
glib10 1.0.6
gtk+ 1.1.2
gtk+ 1.0.5
glib10 1.0.6

(the g*10's are for gnome).

i've got a little snippet of code that segfaults everytime i call it.
if this is a stupid error, i'm sorry, i'm still learning C.

<snip-snip>

#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>


gchar
*thishostname()
{
	struct hostent *thishost;
	sethostent(0);
	thishost = gethostent() ;
	endhostent();
	return thishost->h_name;
	
}

void
main
{
	g_print("hostname: %s \n", thishostname());
}


<snip-snip>


it bombs every time w/o fail. what is it that i'm missing?

thanks,

-l



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