diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-12-17 11:50:33 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-12-18 15:03:05 +0100 |
commit | 41f11239c0c83c378643fc4942c726a49025b3b8 (patch) | |
tree | 81d9dcdf214898e4f1108a534808fec3f0f5e230 /src/machine/machined-dbus.c | |
parent | process-util: make get_process_environ() safer (diff) | |
download | systemd-41f11239c0c83c378643fc4942c726a49025b3b8.tar.xz systemd-41f11239c0c83c378643fc4942c726a49025b3b8.zip |
fileio: replace read_nul_string() by read_line() with a special flag
read_line() is a lot more careful and optimized than read_nul_string()
but does mostly the same thing. let's replace the latter by the former,
just with a special flag that toggles between the slightly different EOL
rules if both.
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 9afae72ae5..fea9cc2633 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -637,8 +637,8 @@ static int clean_pool_done(Operation *operation, int ret, sd_bus_error *error) { if (success) /* The resulting temporary file could not be updated, ignore it. */ return ret; - r = read_nul_string(f, &name); - if (r < 0 || isempty(name)) /* Same here... */ + r = read_nul_string(f, LONG_LINE_MAX, &name); + if (r <= 0) /* Same here... */ return ret; return sd_bus_error_set_errnof(error, ret, "Failed to remove image %s: %m", name); @@ -660,10 +660,10 @@ static int clean_pool_done(Operation *operation, int ret, sd_bus_error *error) { _cleanup_free_ char *name = NULL; uint64_t size; - r = read_nul_string(f, &name); + r = read_nul_string(f, LONG_LINE_MAX, &name); if (r < 0) return r; - if (isempty(name)) /* reached the end */ + if (r == 0) /* reached the end */ break; errno = 0; |