tree-wide: use read_full_virtual_file() where appropriate

Wherever we read virtual files we better should use
read_full_virtual_file(), to make sure we get a consistent response
given how weird the kernel's handling with partial read on such file
systems is.
This commit is contained in:
Lennart Poettering
2021-03-17 18:43:42 +01:00
parent 04820600e7
commit 627055ce9a
8 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ int cg_read_event(
if (r < 0)
return r;
r = read_full_file(events, &content, NULL);
r = read_full_virtual_file(events, &content, NULL);
if (r < 0)
return r;
+1 -1
View File
@@ -114,7 +114,7 @@ static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *ret_mn
xsprintf(path, "/proc/self/fdinfo/%i", subfd);
}
r = read_full_file(path, &fdinfo, NULL);
r = read_full_virtual_file(path, &fdinfo, NULL);
if (r == -ENOENT) /* The fdinfo directory is a relatively new addition */
return -EOPNOTSUPP;
if (r < 0)
+1 -1
View File
@@ -1548,7 +1548,7 @@ int pidfd_get_pid(int fd, pid_t *ret) {
xsprintf(path, "/proc/self/fdinfo/%i", fd);
r = read_full_file(path, &fdinfo, NULL);
r = read_full_virtual_file(path, &fdinfo, NULL);
if (r == -ENOENT) /* if fdinfo doesn't exist we assume the process does not exist */
return -ESRCH;
if (r < 0)