asserts
[oweals/gnunet.git] / src / util / resolver_api.c
index 9e54282fa8b996b64eca1d7084e38001c4d269b9..94844289e261c2141cca2a199671ec1ca6144a37 100644 (file)
@@ -669,14 +669,13 @@ GNUNET_RESOLVER_hostname_get (struct GNUNET_SCHEDULER_Handle *sched,
 
 
 /**
- * Get local hostname
- *
- * @param
+ * Get local fully qualified domain name
+ * @return fqdn
  */
 char *
-GNUNET_RESOLVER_local_hostname_get ( )
+GNUNET_RESOLVER_local_fqdn_get ( void )
 {
-
+  struct hostent *host;
   char hostname[GNUNET_OS_get_hostname_max_length() + 1];
 
 
@@ -688,9 +687,17 @@ GNUNET_RESOLVER_local_hostname_get ( )
     }
 #if DEBUG_RESOLVER
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              _("Resolving our hostname `%s'\n"), hostname);
+              _("Resolving our FQDN `%s'\n"), hostname);
 #endif
-  return GNUNET_strdup (hostname);
+  host = gethostbyname ( hostname );
+  if ( NULL == host)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                _("Could not resolve our FQDN : %s\n"),
+                hstrerror (h_errno));
+    return NULL;
+  }
+  return GNUNET_strdup (host->h_name);
 }
 
 /**