[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:15237] NEW PATCH: Get the short hostname
From:       Sylpheed Patches <sylpheed () thewildbeast ! co ! uk>
Date:       2002-07-30 16:50:37
[Download RAW message or body]

ANNOUNCING THE RELEASE OF A NEW PATCH

Patch Author: Bob Woodside <rwoodside@woodsway.com>
Title:        Get the short hostname
Filename:     sylpheed-0.8.1-get_domain-patch.diff (0.9 kb)
Works with:   0.8.1

Description:
This patch corrects utils.c: get_domain_name to return the FQDN instead of the short hostname.

Notes:
Apply in the main sylpheed directory.

--------------------------
This is an automated message from the Sylpheed Patch homepage.
<http://www.thewildbeast.co.uk/sylpheed>

If you have made a patch that you want included at the
Sylpheed Patch homepage, request details from
<sylpheed@thewildbeast.co.uk>.

["sylpheed-0.8.1-get_domain-patch.diff" (application/octet-stream)]

--- src/utils.c	Tue Jul 30 10:51:48 2002
+++ src/utils-patched.c	Tue Jul 30 10:51:50 2002
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+#include <netdb.h>
 
 #if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
 #  include <wchar.h>
@@ -1440,6 +1441,7 @@
 gchar *get_domain_name(void)
 {
 	static gchar *domain_name = NULL;
+        struct hostent *myfqdn = NULL;
 
 	if (!domain_name) {
 		gchar buf[BUFFSIZE] = "";
@@ -1447,7 +1449,16 @@
 		if (gethostname(buf, sizeof(buf)) < 0) {
 			perror("gethostname");
 			strcpy(buf, "unknown");
-		}
+		}  else  {
+                myfqdn = gethostbyname(buf);
+                if (myfqdn != NULL)  {
+                  memset(buf, '\0', strlen(buf));
+                  strcpy(buf, myfqdn->h_name);
+                  }  else  {
+                  perror("gethostbyname");
+                  strcpy(buf, "unknown");
+                  }
+                }
 
 		domain_name = g_strdup(buf);
 	}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic