-more libexec fixes for OpenSUSE
authorChristian Grothoff <christian@grothoff.org>
Fri, 16 Nov 2012 11:00:22 +0000 (11:00 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 16 Nov 2012 11:00:22 +0000 (11:00 +0000)
src/util/os_installation.c

index b82060bca4421e4f34a58380d47ecb3620ec42c9..c6dca83909528f323d00d38e4ffba91494c02566 100644 (file)
@@ -523,8 +523,30 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
     break;
   case GNUNET_OS_IPK_LIBDIR:
     if (isbasedir)
+    {
       dirname =
           DIR_SEPARATOR_STR "lib" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR;
+      tmp = GNUNET_malloc (strlen (execpath) + strlen (dirname) + 1);
+      sprintf (tmp, "%s%s", execpath, dirname);
+      if ( (GNUNET_YES !=
+           GNUNET_DISK_directory_test (tmp, GNUNET_YES)) &&
+          (4 == sizeof (void *)) )
+      {
+       GNUNET_free (tmp);
+       dirname =
+         DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR;
+       tmp = GNUNET_malloc (strlen (execpath) + strlen (dirname) + 1);
+       sprintf (tmp, "%s%s", execpath, dirname);
+      }
+      if ( (GNUNET_YES !=
+           GNUNET_DISK_directory_test (tmp, GNUNET_YES)) &&
+          (8 == sizeof (void *)) )
+      {
+       dirname =
+         DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR;
+      }
+      GNUNET_free (tmp);
+    }
     else
       dirname = DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR;
     break;
@@ -547,9 +569,33 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
     break;
   case GNUNET_OS_IPK_LIBEXECDIR:
     if (isbasedir)
+    {
       dirname =
         DIR_SEPARATOR_STR "lib" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR \
         "libexec" DIR_SEPARATOR_STR;
+      tmp = GNUNET_malloc (strlen (execpath) + strlen (dirname) + 1);
+      sprintf (tmp, "%s%s", execpath, dirname);
+      if ( (GNUNET_YES !=
+           GNUNET_DISK_directory_test (tmp, GNUNET_YES)) &&
+          (4 == sizeof (void *)) )
+      {
+       GNUNET_free (tmp);
+       dirname =
+         DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR \
+         "libexec" DIR_SEPARATOR_STR;
+       tmp = GNUNET_malloc (strlen (execpath) + strlen (dirname) + 1);
+       sprintf (tmp, "%s%s", execpath, dirname);
+      }
+      if ( (GNUNET_YES !=
+           GNUNET_DISK_directory_test (tmp, GNUNET_YES)) &&
+          (8 == sizeof (void *)) )
+      {
+       dirname =
+         DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR \
+         "libexec" DIR_SEPARATOR_STR;
+      }
+      GNUNET_free (tmp);
+    }
     else
       dirname =
         DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR \