mirror of
https://github.com/fluencelabs/musl
synced 2025-07-03 16:41:59 +00:00
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:
@ -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;
|
||||
|
Reference in New Issue
Block a user