about summary refs log tree commit diff
path: root/src/stat
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-02 12:59:45 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-02 12:59:45 -0400
commitc8c0844f7fbcb955848ca84432e5ffcf71f1cef1 (patch)
tree57aee97670957a956d6a387d1b33d6fd987765e9 /src/stat
parent0dc4824479e357a3e23a02d35527e23fca920343 (diff)
downloadmusl-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/stat')
-rw-r--r--src/stat/fchmodat.c4
1 files changed, 3 insertions, 1 deletions
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 <stdio.h>
 #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);