summaryrefslogtreecommitdiff
path: root/src/vconsole
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-12-01 20:43:19 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-12-09 21:36:08 -0500
commit553acb7b6b8d4f16a4747b1f978e8b7888fbfb2c (patch)
treeb9a473c853c616b256ed3ea1dc5f8e9c7838b289 /src/vconsole
parentcb01aedc3b4ba70859267159fe716253e3551ec6 (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/vconsole')
-rw-r--r--src/vconsole/vconsole-setup.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index b7a536b983..28371711b6 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -54,8 +54,9 @@ static int disable_utf8(int fd) {
if (ioctl(fd, KDSKBMODE, K_XLATE) < 0)
r = -errno;
- if (loop_write(fd, "\033%@", 3, false) < 0)
- r = -errno;
+ k = loop_write(fd, "\033%@", 3, false);
+ if (k < 0)
+ r = k;
k = write_string_file("/sys/module/vt/parameters/default_utf8", "0");
if (k < 0)
@@ -86,8 +87,9 @@ static int enable_utf8(int fd) {
r = -errno;
}
- if (loop_write(fd, "\033%G", 3, false) < 0)
- r = -errno;
+ k = loop_write(fd, "\033%G", 3, false);
+ if (k < 0)
+ r = k;
k = write_string_file("/sys/module/vt/parameters/default_utf8", "1");
if (k < 0)