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:
Sami Kerola 2012-01-21 16:24:33 +01:00
parent bc974b3c33
commit ae08eb8af6

View File

@ -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();
}
}