-typo
[oweals/gnunet.git] / src / util / client.c
index d9be7f46ed42d030f8845fd5e009a131f2c4ce9f..73cca2383c197a1843f09b7a3cccea91bd39f81b 100644 (file)
@@ -261,12 +261,22 @@ try_unixpath (const char *service_name,
 #if AF_UNIX
   struct GNUNET_CONNECTION_Handle *connection;
   char *unixpath;
+  struct sockaddr_un s_un;
 
   unixpath = NULL;
   if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && 
       (0 < strlen (unixpath)))     
   {
     /* We have a non-NULL unixpath, need to validate it */
+    if (strlen (unixpath) >= sizeof (s_un.sun_path))
+    {
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+          _("UNIXPATH `%s' too long, maximum length is %llu\n"), unixpath,
+          (unsigned long long) sizeof (s_un.sun_path));
+      unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
+      LOG (GNUNET_ERROR_TYPE_INFO,
+          _("Using `%s' instead\n"), unixpath);
+    }
     connection = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg, unixpath);
     if (NULL != connection)
     {
@@ -740,6 +750,8 @@ GNUNET_CLIENT_service_test (const char *service,
              _("UNIXPATH `%s' too long, maximum length is %llu\n"), unixpath,
              (unsigned long long) sizeof (s_un.sun_path));
        unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
+        LOG (GNUNET_ERROR_TYPE_INFO,
+             _("Using `%s' instead\n"), unixpath);
       }
     }
     if (NULL != unixpath)