Revert "tree-wide: Mount file descriptors via /proc/<pid>/fd"
This commit is contained in:
committed by
Luca Boccassi
parent
0df7d52576
commit
7b9da3861a
+3
-8
@@ -8,8 +8,6 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "format-util.h"
|
||||
#include "process-util.h"
|
||||
#include "stdio-util.h"
|
||||
|
||||
/* maximum length of fdname */
|
||||
@@ -114,17 +112,14 @@ static inline int dir_fd_is_root_or_cwd(int dir_fd) {
|
||||
return dir_fd == AT_FDCWD ? true : path_is_root_at(dir_fd, NULL);
|
||||
}
|
||||
|
||||
/* The maximum length a buffer for a /proc/<pid>/fd/<fd> path needs. We intentionally don't use /proc/self/fd
|
||||
* as these paths might be read by other programs (for example when mounting file descriptors the source path
|
||||
* ends up in /proc/mounts and related files) for which /proc/self/fd will be interpreted differently than
|
||||
* /proc/<pid>/fd. */
|
||||
/* The maximum length a buffer for a /proc/self/fd/<fd> path needs */
|
||||
#define PROC_FD_PATH_MAX \
|
||||
(STRLEN("/proc//fd/") + DECIMAL_STR_MAX(pid_t) + DECIMAL_STR_MAX(int))
|
||||
(STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int))
|
||||
|
||||
static inline char *format_proc_fd_path(char buf[static PROC_FD_PATH_MAX], int fd) {
|
||||
assert(buf);
|
||||
assert(fd >= 0);
|
||||
assert_se(snprintf_ok(buf, PROC_FD_PATH_MAX, "/proc/" PID_FMT "/fd/%i", getpid_cached(), fd));
|
||||
assert_se(snprintf_ok(buf, PROC_FD_PATH_MAX, "/proc/self/fd/%i", fd));
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user