-typo
[oweals/gnunet.git] / src / util / client.c
index 1f08ea25c71751eb3604ff771812d0cf4c0f4fae..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)
     {