summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/mountpoint-util.c11
-rw-r--r--src/basic/process-util.c11
-rw-r--r--src/import/importd.c11
-rw-r--r--src/shared/logs-show.c11
4 files changed, 12 insertions, 32 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index ad22894a59..751d5a35ce 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -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;
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index cf2dca1dc4..c891f74be8 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -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;
diff --git a/src/import/importd.c b/src/import/importd.c
index ed757019cf..4675aa5a61 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -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;
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 6ed9a6890f..d372e096c4 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -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");