Commit 427ea60b authored by Pavel Emelyanov's avatar Pavel Emelyanov

Open proc helper fds with O_PATH

These descriptors are purely used for openat()-s, so having
them opened with O_PATH is OK and saves a little bit operations
in the kernel space.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 7b32bee4
...@@ -227,7 +227,7 @@ static int open_proc_sfd(char *path) ...@@ -227,7 +227,7 @@ static int open_proc_sfd(char *path)
int fd, ret; int fd, ret;
close_proc(); close_proc();
fd = open(path, O_DIRECTORY | O_RDONLY); fd = open(path, O_DIRECTORY | O_PATH);
if (fd == -1) { if (fd == -1) {
pr_perror("Can't open %s", path); pr_perror("Can't open %s", path);
return -1; return -1;
...@@ -271,7 +271,7 @@ inline int open_pid_proc(pid_t pid) ...@@ -271,7 +271,7 @@ inline int open_pid_proc(pid_t pid)
else else
snprintf(path, sizeof(path), "%d", pid); snprintf(path, sizeof(path), "%d", pid);
fd = openat(dfd, path, O_RDONLY); fd = openat(dfd, path, O_PATH);
if (fd < 0) { if (fd < 0) {
pr_perror("Can't open %s", path); pr_perror("Can't open %s", path);
set_cr_errno(ESRCH); set_cr_errno(ESRCH);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment