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/tty-ask-password-agent | |
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/tty-ask-password-agent')
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index fa8448cfae..5fc27f9ae5 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -103,9 +103,9 @@ static int ask_password_plymouth( if (!packet) return log_oom(); - k = loop_write(fd, packet, n + 1, true); - if (k != n + 1) - return k < 0 ? (int) k : -EIO; + r = loop_write(fd, packet, n + 1, true); + if (r < 0) + return r; pollfd[POLL_SOCKET].fd = fd; pollfd[POLL_SOCKET].events = POLLIN; @@ -165,9 +165,9 @@ static int ask_password_plymouth( if (asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1), message, &n) < 0) return -ENOMEM; - k = loop_write(fd, packet, n+1, true); - if (k != n + 1) - return k < 0 ? (int) k : -EIO; + r = loop_write(fd, packet, n+1, true); + if (r < 0) + return r; accept_cached = false; p = 0; |