diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-12-01 20:43:19 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-12-09 21:36:08 -0500 |
commit | 553acb7b6b8d4f16a4747b1f978e8b7888fbfb2c (patch) | |
tree | b9a473c853c616b256ed3ea1dc5f8e9c7838b289 /src/libsystemd-terminal/subterm.c | |
parent | cb01aedc3b4ba70859267159fe716253e3551ec6 (diff) |
treewide: sanitize loop_write
loop_write() didn't follow the usual systemd rules and returned status
partially in errno and required extensive checks from callers. Some of
the callers dealt with this properly, but many did not, treating
partial writes as successful. Simplify things by conforming to usual rules.
Diffstat (limited to 'src/libsystemd-terminal/subterm.c')
-rw-r--r-- | src/libsystemd-terminal/subterm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsystemd-terminal/subterm.c b/src/libsystemd-terminal/subterm.c index 75a25e5590..78efc9d7c0 100644 --- a/src/libsystemd-terminal/subterm.c +++ b/src/libsystemd-terminal/subterm.c @@ -117,14 +117,14 @@ static int output_winch(Output *o) { } static int output_flush(Output *o) { - ssize_t len; + int r; if (o->n_obuf < 1) return 0; - len = loop_write(o->fd, o->obuf, o->n_obuf, false); - if (len < 0) - return log_error_errno(len, "error: cannot write to TTY (%zd): %m", len); + r = loop_write(o->fd, o->obuf, o->n_obuf, false); + if (r < 0) + return log_error_errno(r, "error: cannot write to TTY: %m"); o->n_obuf = 0; |