aboutsummaryrefslogtreecommitdiff
path: root/src/util/os_installation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r--src/util/os_installation.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 1e51c1327..43feba87b 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -452,6 +452,11 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
452 DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR "doc" DIR_SEPARATOR_STR \ 452 DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR "doc" DIR_SEPARATOR_STR \
453 "gnunet" DIR_SEPARATOR_STR; 453 "gnunet" DIR_SEPARATOR_STR;
454 break; 454 break;
455 case GNUNET_OS_IPK_LIBEXECDIR:
456 dirname =
457 DIR_SEPARATOR_STR "lib" DIR_SEPARATOR_STR "gnunet" DIR_SEPARATOR_STR \
458 "libexec" DIR_SEPARATOR_STR;
459 break;
455 default: 460 default:
456 GNUNET_free (execpath); 461 GNUNET_free (execpath);
457 return NULL; 462 return NULL;
@@ -464,6 +469,32 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
464 469
465 470
466/** 471/**
472 * Given the name of a gnunet-helper, gnunet-service or gnunet-daemon
473 * binary, try to prefix it with the libexec/-directory to get the
474 * full path.
475 *
476 * @param progname name of the binary
477 * @return full path to the binary, if possible, otherwise copy of 'progname'
478 */
479char *
480GNUNET_OS_get_libexec_binary_path (const char *progname)
481{
482 char *libexecdir;
483 char *binary;
484
485 libexecdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
486 if (NULL == libexecdir)
487 return GNUNET_strdup (progname);
488 GNUNET_asprintf (&binary,
489 "%s%s",
490 libexecdir,
491 progname);
492 GNUNET_free (libexecdir);
493 return binary;
494}
495
496
497/**
467 * Check whether an executable exists and possibly 498 * Check whether an executable exists and possibly
468 * if the suid bit is set on the file. 499 * if the suid bit is set on the file.
469 * Attempts to find the file using the current 500 * Attempts to find the file using the current