X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fos_installation.c;h=035259ff6b234e1d0305044b51222fd2f4380cb1;hb=9b0414d6f98f33d7e1c33dafe105eb58da0bf79b;hp=c520c6f79450f6a0ec864be600a98f50bb97221f;hpb=60e1efa23b8590f4579bb2aa4937b494f40ac5cc;p=oweals%2Fgnunet.git diff --git a/src/util/os_installation.c b/src/util/os_installation.c index c520c6f79..035259ff6 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c @@ -65,7 +65,7 @@ get_path_from_proc_maps () while (NULL != fgets (line, sizeof (line), f)) { if ((1 == - SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%s", dir)) && + SSCANF (line, "%*x-%*x %*c%*c%*c%*c %*x %*2u:%*2u %*u%*[ ]%1023s", dir)) && (NULL != (lgu = strstr (dir, "libgnunetutil")))) { lgu[0] = '\0'; @@ -101,6 +101,11 @@ get_path_from_proc_exe () lnk[size] = '\0'; while ((lnk[size] != '/') && (size > 0)) size--; + /* test for being in lib/gnunet/libexec/ */ + if ( (size > strlen ("/gnunet/libexec/")) && + (0 == strcmp ("/gnunet/libexec/", + &lnk[size - strlen ("/gnunet/libexec/")])) ) + size -= strlen ("gnunet/libexec/"); if ((size < 4) || (lnk[size - 4] != '/')) { /* not installed in "/bin/" -- binary path probably useless */ @@ -568,6 +573,8 @@ GNUNET_OS_get_libexec_binary_path (const char *progname) char *libexecdir; char *binary; + if (DIR_SEPARATOR == progname[0]) + return GNUNET_strdup (progname); libexecdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR); if (NULL == libexecdir) return GNUNET_strdup (progname);