summaryrefslogtreecommitdiff
path: root/src/stdio/vdprintf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-20 22:24:28 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-20 22:24:28 -0500
commit4ee039f3545976f9e3e25a7e5d7b58f1f2316dc3 (patch)
tree59294330e4d6081d28df7f45b594a350d32cfae8 /src/stdio/vdprintf.c
parentba68efc921578438db5ab263edd2e9c4654bb412 (diff)
downloadmusl-4ee039f3545976f9e3e25a7e5d7b58f1f2316dc3.tar.gz
avoid referencing address of extern function from vdprintf
this change is in preparation for upcoming PIC/shared library support. the intent is to avoid going through the GOT, mainly so that dprintf is operable immediately, prior to processing of relocations. having dprintf accessible from the dynamic linker will make writing and debugging the dynamic linker much easier.
Diffstat (limited to 'src/stdio/vdprintf.c')
-rw-r--r--src/stdio/vdprintf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/stdio/vdprintf.c b/src/stdio/vdprintf.c
index bfb1b0a9..35ed6e0b 100644
--- a/src/stdio/vdprintf.c
+++ b/src/stdio/vdprintf.c
@@ -1,11 +1,16 @@
#include "stdio_impl.h"
+static size_t wrap_write(FILE *f, const unsigned char *buf, size_t len)
+{
+ return __stdio_write(f, buf, len);
+}
+
int vdprintf(int fd, const char *fmt, va_list ap)
{
int r;
char buf[BUFSIZ];
FILE f = {
- .fd = fd, .lbf = EOF, .write = __stdio_write,
+ .fd = fd, .lbf = EOF, .write = wrap_write,
.buf = buf+UNGET, .buf_size = sizeof buf - UNGET
};
r = vfprintf(&f, fmt, ap);