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/stat/fchmodat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/stat') diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c index c1410bc5..aeb50bc5 100644 --- a/src/stat/fchmodat.c +++ b/src/stat/fchmodat.c @@ -4,6 +4,8 @@ #include #include "syscall.h" +void __procfdname(char *, unsigned); + int fchmodat(int fd, const char *path, mode_t mode, int flag) { if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag); @@ -26,7 +28,7 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag) return __syscall_ret(fd2); } - snprintf(proc, sizeof proc, "/proc/self/fd/%d", fd2); + __procfdname(proc, fd2); if (!(ret = __syscall(SYS_stat, proc, &st)) && !S_ISLNK(st.st_mode)) ret = __syscall(SYS_chmod, proc, mode); -- cgit v1.2.1