{
struct termios tattr;
- fcntl(STDIN_FILENO, F_GETFL, saved_fl);
+ *saved_fl = fcntl(STDIN_FILENO, F_GETFL);
+ if (*saved_fl == -1)
+ err(EXIT_FAILURE, _("fcntl failed"));
+
tcgetattr(STDIN_FILENO, saved_attributes);
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
memcpy(&tattr, saved_attributes, sizeof(struct termios));
ssize_t rc;
struct winsize ws;
struct termios saved_attributes;
- int saved_fl;
+ int saved_fl = 0;
if (!isatty(STDIN_FILENO))
errx(EXIT_FAILURE, _("stdin does not refer to a terminal"));