mirror of
https://github.com/systemd/systemd.git
synced 2025-01-26 14:04:03 +03:00
tree-wide: port various places to find_line_startswith()
This commit is contained in:
parent
7b82d95f8d
commit
50ed5cbf5f
@ -125,14 +125,9 @@ static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *ret_mn
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
p = startswith(fdinfo, "mnt_id:");
|
||||
if (!p) {
|
||||
p = strstr(fdinfo, "\nmnt_id:");
|
||||
if (!p) /* The mnt_id field is a relatively new addition */
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
p += 8;
|
||||
}
|
||||
p = find_line_startswith(fdinfo, "mnt_id:");
|
||||
if (!p) /* The mnt_id field is a relatively new addition */
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
p += strspn(p, WHITESPACE);
|
||||
p[strcspn(p, WHITESPACE)] = 0;
|
||||
|
@ -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;
|
||||
|
@ -590,14 +590,9 @@ static int manager_on_notify(sd_event_source *s, int fd, uint32_t revents, void
|
||||
|
||||
buf[n] = 0;
|
||||
|
||||
p = startswith(buf, "X_IMPORT_PROGRESS=");
|
||||
if (!p) {
|
||||
p = strstr(buf, "\nX_IMPORT_PROGRESS=");
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
p += 19;
|
||||
}
|
||||
p = find_line_startswith(buf, "X_IMPORT_PROGRESS=");
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
e = strchrnul(p, '\n');
|
||||
*e = 0;
|
||||
|
@ -93,14 +93,9 @@ static int url_from_catalog(sd_journal *j, char **ret) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to find catalog entry: %m");
|
||||
|
||||
weblink = startswith(t, "Documentation:");
|
||||
if (!weblink) {
|
||||
weblink = strstr(t + 1, "\nDocumentation:");
|
||||
if (!weblink)
|
||||
goto notfound;
|
||||
|
||||
weblink += 15;
|
||||
}
|
||||
weblink = find_line_startswith(t, "Documentation:");
|
||||
if (!weblink)
|
||||
goto notfound;
|
||||
|
||||
/* Skip whitespace to value */
|
||||
weblink += strspn(weblink, " \t");
|
||||
|
Loading…
x
Reference in New Issue
Block a user