diff libpurple/protocols/bonjour/bonjour.c @ 25705:e23b447aa5ca

propagate from branch 'im.pidgin.pidgin' (head e3ceb09b71185a9074ce73733f2a65b437c9a545) to branch 'im.pidgin.soc.2008.vv' (head a94b36f0065825b75de573746f680ae616b34f41)
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 16 Jul 2008 21:55:08 +0000
parents 3da0957e7821 399975ad001c
children bcad7dc4b453
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c	Wed Jul 16 21:42:13 2008 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Wed Jul 16 21:55:08 2008 +0000
@@ -641,7 +641,6 @@
 	struct passwd *info;
 #endif
 	const char *fullname = NULL, *splitpoint, *tmp;
-	char hostname[255];
 	gchar *conv = NULL;
 
 #ifndef _WIN32
@@ -691,13 +690,7 @@
 
 	/* Try to figure out a good host name to use */
 	/* TODO: Avoid 'localhost,' if possible */
-	if (gethostname(hostname, sizeof(hostname)) != 0) {
-		purple_debug_warning("bonjour", "Error when getting host name: %s.  Using \"localhost.\"\n",
-				g_strerror(errno));
-		strcpy(hostname, "localhost");
-	}
-	hostname[sizeof(hostname) - 1] = '\0';
-	default_hostname = g_strdup(hostname);
+	default_hostname = g_strdup(purple_get_host_name());
 }
 
 static void