tload: check write() return value
Exit at rare events when writing to tty is unsuccessful. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
bc974b3c33
commit
ae08eb8af6
6
tload.c
6
tload.c
@ -187,8 +187,10 @@ int main(int argc, char **argv)
|
||||
if (i > 0)
|
||||
screen[i] = ' ';
|
||||
|
||||
write(fd, "\033[H", 3);
|
||||
write(fd, screen, scr_size - 1);
|
||||
if (write(fd, "\033[H", 3) < 0)
|
||||
xerr(EXIT_FAILURE, _("writing to tty failed"));
|
||||
if (write(fd, screen, scr_size - 1) < 0)
|
||||
xerr(EXIT_FAILURE, _("writing to tty failed"));
|
||||
pause();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user