Page MenuHomeFreeBSD

D9346.id24469.diff
No OneTemporary

D9346.id24469.diff

Index: libexec/rtld-elf/rtld.1
===================================================================
--- libexec/rtld-elf/rtld.1
+++ libexec/rtld-elf/rtld.1
@@ -199,6 +199,11 @@
sandboxes, when global namespaces such as the filesystem are unavailable.
It is consulted just after LD_LIBRARY_PATH.
This variable is unset for set-user-ID and set-group-ID programs.
+.It Ev LD_PRINT_ERROR
+When set to a nonempty string, causes
+.Nm
+to print any error messages that would be available to the application via
+.Xr dlopen 3 .
.It Ev LD_BIND_NOW
When set to a nonempty string, causes
.Nm
Index: libexec/rtld-elf/rtld.c
===================================================================
--- libexec/rtld-elf/rtld.c
+++ libexec/rtld-elf/rtld.c
@@ -186,6 +186,7 @@
static char *ld_elf_hints_path; /* Environment variable for alternative hints path */
static char *ld_tracing; /* Called from ldd to print libs */
static char *ld_utrace; /* Use utrace() to log events. */
+static char *ld_printerror; /* Report _rtld_error() messages to stdout */
static struct obj_entry_q obj_list; /* Queue of all loaded objects */
static Obj_Entry *obj_main; /* The main program shared object */
static Obj_Entry obj_rtld; /* The dynamic linker shared object */
@@ -453,6 +454,7 @@
(ld_elf_hints_path != NULL) || ld_loadfltr;
ld_tracing = getenv(_LD("TRACE_LOADED_OBJECTS"));
ld_utrace = getenv(_LD("UTRACE"));
+ ld_printerror = getenv(LD_ "PRINT_ERROR");
if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0)
ld_elf_hints_path = ld_elf_hints_default;
@@ -764,6 +766,8 @@
rtld_vsnprintf(buf, sizeof buf, fmt, ap);
error_message = buf;
va_end(ap);
+ if (ld_printerror != NULL && *ld_printerror != '\0')
+ rtld_printf("RTLD Error: %s\n", error_message);
}
/*

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 10, 4:14 PM (2 m, 54 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23537966
Default Alt Text
D9346.id24469.diff (1 KB)

Event Timeline