tree-wide: port various places to find_line_startswith()

This commit is contained in:
Lennart Poettering
2023-03-24 18:30:20 +01:00
parent 7b82d95f8d
commit 50ed5cbf5f
4 changed files with 12 additions and 32 deletions
+3 -8
View File
@@ -1453,14 +1453,9 @@ int pidfd_get_pid(int fd, pid_t *ret) {
if (r < 0)
return r;
p = startswith(fdinfo, "Pid:");
if (!p) {
p = strstr(fdinfo, "\nPid:");
if (!p)
return -ENOTTY; /* not a pidfd? */
p += 5;
}
p = find_line_startswith(fdinfo, "Pid:");
if (!p)
return -ENOTTY; /* not a pidfd? */
p += strspn(p, WHITESPACE);
p[strcspn(p, WHITESPACE)] = 0;