* @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>
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--;
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);
}
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);
/* 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;
}
return tmp;
}
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
/* end of os_installation.c */