get full hostname
authorPaul Mangan <paul@claws-mail.org>
Mon, 25 Mar 2002 10:02:55 +0000 (10:02 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 25 Mar 2002 10:02:55 +0000 (10:02 +0000)
ChangeLog.claws
configure.in
src/utils.c

index fdfb913f862ccd1a9fac8c8d41baca4f649cceeb..c90e57b4f839cdba0fcb95de5ad4618c73da1a7f 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-25 [paul]      0.7.4claws41
+
+       * src/utils.c
+               get full hostname. patch submitted by
+               Bob Woodside <rwoodside1@comcast.net>
+
 2002-03-25 [paul]      0.7.4claws40
 
        * src/account.c
 2002-03-25 [paul]      0.7.4claws40
 
        * src/account.c
index de76bf60bc320d8b2e0b6ea49d9b49b8e4bbc3bd..42ef6879b8ffe660b72a6fc110102f38554262bd 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws40
+EXTRA_VERSION=claws41
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 9cf692566199e4e3f816ffcb88e7494025b88dbe..f8ce2737499948cc3cc91b721260d6522a0713c2 100644 (file)
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+#include <netdb.h>
 
 #if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
 #  include <wchar.h>
 
 #if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
 #  include <wchar.h>
@@ -1318,6 +1319,7 @@ gchar *get_tmp_file(void)
 gchar *get_domain_name(void)
 {
        static gchar *domain_name = NULL;
 gchar *get_domain_name(void)
 {
        static gchar *domain_name = NULL;
+        struct hostent *myfqdn = NULL;
 
        if (!domain_name) {
                gchar buf[BUFFSIZE] = "";
 
        if (!domain_name) {
                gchar buf[BUFFSIZE] = "";
@@ -1325,7 +1327,16 @@ gchar *get_domain_name(void)
                if (gethostname(buf, sizeof(buf)) < 0) {
                        perror("gethostname");
                        strcpy(buf, "unknown");
                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);
        }
 
                domain_name = g_strdup(buf);
        }