dhtlog updates
[oweals/gnunet.git] / src / util / os_installation.c
index c610281878b560e1f074aee296096c5ba605e904..2b75a11961febac3895e21a96a5f7b7ec2ee9508 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--;
@@ -220,7 +212,7 @@ get_path_from_PATH ()
   while (NULL != (end = strchr (pos, ':')))
     {
       *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;
 }
@@ -433,10 +426,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 */