aboutsummaryrefslogtreecommitdiff
path: root/libexec/rtld-elf/rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/rtld-elf/rtld.c')
-rw-r--r--libexec/rtld-elf/rtld.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index d5e702652058..96042f7b5af3 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -6155,10 +6155,42 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp,
*fdp = fd;
seen_f = true;
break;
+ } else if (opt == 'o') {
+ struct ld_env_var_desc *l;
+ char *n, *v;
+ u_int ll;
+
+ if (j != arglen - 1) {
+ _rtld_error("Invalid options: %s", arg);
+ rtld_die();
+ }
+ i++;
+ n = argv[i];
+ v = strchr(n, '=');
+ if (v == NULL) {
+ _rtld_error("No '=' in -o parameter");
+ rtld_die();
+ }
+ for (ll = 0; ll < nitems(ld_env_vars); ll++) {
+ l = &ld_env_vars[ll];
+ if (v - n == (ptrdiff_t)strlen(l->n) &&
+ strncmp(n, l->n, v - n) == 0) {
+ l->val = v + 1;
+ break;
+ }
+ }
+ if (ll == nitems(ld_env_vars)) {
+ _rtld_error("Unknown LD_ option %s",
+ n);
+ rtld_die();
+ }
} else if (opt == 'p') {
*use_pathp = true;
} else if (opt == 'u') {
- trust = false;
+ u_int ll;
+
+ for (ll = 0; ll < nitems(ld_env_vars); ll++)
+ ld_env_vars[ll].val = NULL;
} else if (opt == 'v') {
machine[0] = '\0';
mib[0] = CTL_HW;
@@ -6238,6 +6270,7 @@ print_usage(const char *argv0)
" -b <exe> Execute <exe> instead of <binary>, arg0 is <binary>\n"
" -d Ignore lack of exec permissions for the binary\n"
" -f <FD> Execute <FD> instead of searching for <binary>\n"
+ " -o <OPT>=<VAL> Set LD_<OPT> to <VAL>, without polluting env\n"
" -p Search in PATH for named binary\n"
" -u Ignore LD_ environment variables\n"
" -v Display identification information\n"