diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-08-02 12:59:45 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-08-02 12:59:45 -0400 |
commit | c8c0844f7fbcb955848ca84432e5ffcf71f1cef1 (patch) | |
tree | 57aee97670957a956d6a387d1b33d6fd987765e9 /src/misc/realpath.c | |
parent | 0dc4824479e357a3e23a02d35527e23fca920343 (diff) | |
download | musl-c8c0844f7fbcb955848ca84432e5ffcf71f1cef1.tar.gz musl-c8c0844f7fbcb955848ca84432e5ffcf71f1cef1.tar.xz musl-c8c0844f7fbcb955848ca84432e5ffcf71f1cef1.zip |
debloat code that depends on /proc/self/fd/%d with shared function
I intend to add more Linux workarounds that depend on using these pathnames, and some of them will be in "syscall" functions that, from an anti-bloat standpoint, should not depend on the whole snprintf framework.
Diffstat (limited to 'src/misc/realpath.c')
-rw-r--r-- | src/misc/realpath.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/misc/realpath.c b/src/misc/realpath.c index 18335146..d238ed01 100644 --- a/src/misc/realpath.c +++ b/src/misc/realpath.c @@ -6,6 +6,8 @@ #include <errno.h> #include <unistd.h> +void __procfdname(char *, unsigned); + char *realpath(const char *restrict filename, char *restrict resolved) { int fd; @@ -21,7 +23,7 @@ char *realpath(const char *restrict filename, char *restrict resolved) fd = open(filename, O_RDONLY|O_NONBLOCK|O_CLOEXEC); if (fd < 0) return 0; - snprintf(buf, sizeof buf, "/proc/self/fd/%d", fd); + __procfdname(buf, fd); if (!resolved) { alloc = 1; |