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.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 722b274e6ca4..0f5aabae734a 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -60,6 +60,7 @@
#include "rtld.h"
#include "libmap.h"
#include "rtld_tls.h"
+#include "rtld_printf.h"
#ifndef COMPAT_32BIT
#define PATH_RTLD "/libexec/ld-elf.so.1"
@@ -603,7 +604,7 @@ _rtld_error(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- vsnprintf(buf, sizeof buf, fmt, ap);
+ rtld_vsnprintf(buf, sizeof buf, fmt, ap);
error_message = buf;
va_end(ap);
}
@@ -723,7 +724,8 @@ die(void)
if (msg == NULL)
msg = "Fatal error";
- errx(1, "%s", msg);
+ rtld_fdputstr(STDERR_FILENO, msg);
+ _exit(1);
}
/*
@@ -3187,7 +3189,7 @@ trace_loaded_objects(Obj_Entry *obj)
bool is_lib;
if (list_containers && obj->needed != NULL)
- printf("%s:\n", obj->path);
+ rtld_printf("%s:\n", obj->path);
for (needed = obj->needed; needed; needed = needed->next) {
if (needed->obj != NULL) {
if (needed->obj->traced && !list_containers)
@@ -3204,17 +3206,17 @@ trace_loaded_objects(Obj_Entry *obj)
while ((c = *fmt++) != '\0') {
switch (c) {
default:
- putchar(c);
+ rtld_putchar(c);
continue;
case '\\':
switch (c = *fmt) {
case '\0':
continue;
case 'n':
- putchar('\n');
+ rtld_putchar('\n');
break;
case 't':
- putchar('\t');
+ rtld_putchar('\t');
break;
}
break;
@@ -3224,30 +3226,31 @@ trace_loaded_objects(Obj_Entry *obj)
continue;
case '%':
default:
- putchar(c);
+ rtld_putchar(c);
break;
case 'A':
- printf("%s", main_local);
+ rtld_putstr(main_local);
break;
case 'a':
- printf("%s", obj_main->path);
+ rtld_putstr(obj_main->path);
break;
case 'o':
- printf("%s", name);
+ rtld_putstr(name);
break;
#if 0
case 'm':
- printf("%d", sodp->sod_major);
+ rtld_printf("%d", sodp->sod_major);
break;
case 'n':
- printf("%d", sodp->sod_minor);
+ rtld_printf("%d", sodp->sod_minor);
break;
#endif
case 'p':
- printf("%s", path);
+ rtld_putstr(path);
break;
case 'x':
- printf("%p", needed->obj ? needed->obj->mapbase : 0);
+ rtld_printf("%p", needed->obj ? needed->obj->mapbase :
+ 0);
break;
}
break;