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.
This commit is contained in:
parent
0dc4824479
commit
c8c0844f7f
5 changed files with 26 additions and 6 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue