From c8c0844f7fbcb955848ca84432e5ffcf71f1cef1 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 2 Aug 2013 12:59:45 -0400 Subject: 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. --- src/misc/realpath.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/misc/realpath.c') 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 #include +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; -- cgit v1.2.1