Returns now GNUNET_SYSERR
[oweals/gnunet.git] / src / util / os_installation.c
index c610281878b560e1f074aee296096c5ba605e904..cbbc614334bf38762fffdf4c0386d83d7673d746 100644 (file)
  * @brief get paths used by the program
  * @author Milan
  */
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
 #include <sys/stat.h>
 #include <stdlib.h>
 #include <string.h>
@@ -96,11 +87,12 @@ get_path_from_proc_exe ()
   GNUNET_snprintf (fn, 
                   sizeof(fn), "/proc/%u/exe", getpid ());
   size = readlink (fn, lnk, sizeof (lnk)-1);
-  if ((size == 0) || (size >= sizeof(lnk)-1))
+  if (size <= 0)
     {
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
       return NULL;
     }
+  GNUNET_assert (size < sizeof (lnk));
   lnk[size] = '\0';
   while ((lnk[size] != '/') && (size > 0))
     size--;
@@ -217,10 +209,10 @@ get_path_from_PATH ()
   buf = GNUNET_malloc (strlen (path) + 20);
   pos = path;
 
-  while (NULL != (end = strchr (pos, ':')))
+  while (NULL != (end = strchr (pos, PATH_SEPARATOR)))
     {
       *end = '\0';
-      sprintf (buf, "%s/%s", pos, "gnunetd");
+      sprintf (buf, "%s/%s", pos, "gnunet-arm");
       if (GNUNET_DISK_file_test (buf) == GNUNET_YES)
         {
           pos = GNUNET_strdup (pos);
@@ -230,7 +222,7 @@ get_path_from_PATH ()
         }
       pos = end + 1;
     }
-  sprintf (buf, "%s/%s", pos, "gnunetd");
+  sprintf (buf, "%s/%s", pos, "gnunet-arm");
   if (GNUNET_DISK_file_test (buf) == GNUNET_YES)
     {
       pos = GNUNET_strdup (pos);
@@ -295,7 +287,8 @@ os_get_gnunet_path ()
   /* other attempts here */
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               _
-              ("Could not determine installation path for GNUnet.  Set `%s' environment variable.\n"),
+              ("Could not determine installation path for %s.  Set `%s' environment variable.\n"),
+             "GNUnet",
               "GNUNET_PREFIX");
   return NULL;
 }
@@ -423,6 +416,10 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
         DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR "locale"
         DIR_SEPARATOR_STR;
       break;
+    case GNUNET_OS_IPK_ICONDIR:
+      dirname =
+        DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR "icons" DIR_SEPARATOR_STR;
+      break;
     default:
       GNUNET_free (execpath);
       return NULL;
@@ -433,10 +430,4 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
   return tmp;
 }
 
-#if 0                           /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
 /* end of os_installation.c */