summaryrefslogtreecommitdiffstats
path: root/src/core/manager-serialize.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-09-08 17:02:11 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2023-09-08 21:59:44 +0200
commit0df7d525763ce76269c414d9c0a9ee9978edf299 (patch)
tree1f75d063077ba0dca01a637404b017d921cb9254 /src/core/manager-serialize.c
parentconf-parser: parse main config first only if not symlinked to/as drop-in (diff)
downloadsystemd-0df7d525763ce76269c414d9c0a9ee9978edf299.tar.xz
systemd-0df7d525763ce76269c414d9c0a9ee9978edf299.zip
serialize: add common deserialize_read_line() helper and use it everywhere
This introduces a common helper replacing three very similar uses. Prompted by review of: #27890
Diffstat (limited to 'src/core/manager-serialize.c')
-rw-r--r--src/core/manager-serialize.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/manager-serialize.c b/src/core/manager-serialize.c
index f4ad9b0642..71234ae936 100644
--- a/src/core/manager-serialize.c
+++ b/src/core/manager-serialize.c
@@ -338,17 +338,13 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
_cleanup_(manager_reloading_stopp) _unused_ Manager *reloading = manager_reloading_start(m);
for (;;) {
- _cleanup_free_ char *line = NULL;
- const char *val, *l;
+ _cleanup_free_ char *l = NULL;
+ const char *val;
- r = read_line(f, LONG_LINE_MAX, &line);
+ r = deserialize_read_line(f, &l);
if (r < 0)
- return log_error_errno(r, "Failed to read serialization line: %m");
- if (r == 0)
- break;
-
- l = strstrip(line);
- if (isempty(l)) /* end marker */
+ return r;
+ if (r == 0) /* eof or end marker */
break;
if ((val = startswith(l, "current-job-id="))) {