rlimit-util: use read_full_file() for /proc/PID/limits

This one uses "seq_file", i.e. normal FILE stream just works.
This commit is contained in:
Mike Yuan
2025-05-01 13:10:26 +09:00
committed by Yu Watanabe
parent 36b159ab3f
commit 42dbe9d6b9
+2 -2
View File
@@ -471,12 +471,12 @@ int pid_getrlimit(pid_t pid, int resource, struct rlimit *ret) {
const char *p = procfs_file_alloca(pid, "limits");
_cleanup_free_ char *limits = NULL;
r = read_full_virtual_file(p, &limits, NULL);
r = read_full_file(p, &limits, /* ret_size = */ NULL);
if (r < 0)
return -EPERM; /* propagate original permission error if we can't access the limits file */
_cleanup_strv_free_ char **l = NULL;
l = strv_split(limits, "\n");
l = strv_split_newlines(limits);
if (!l)
return -ENOMEM;