Changeset 87822ce in mainline for uspace/lib/clui/tinput.c


Ignore:
Timestamp:
2021-03-04T19:14:30Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d6c4d40
Parents:
760a392
Message:

Avoid infinite loop when console communication is broken

Need to make sure callers of console_get_event_timeout() can distinguish
between timeout and I/O error. Fix all callers of console_get_event()
and console_get_event_timeout() not to enter infinite loop when console
connection is broken. Also avoid setting of errno variable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/clui/tinput.c

    r760a392 r87822ce  
    874874errno_t tinput_read_i(tinput_t *ti, const char *istr, char **dstr)
    875875{
     876        errno_t rc;
     877
    876878        console_flush(ti->console);
    877879        if (console_get_size(ti->console, &ti->con_cols, &ti->con_rows) != EOK)
     
    891893
    892894                cons_event_t ev;
    893                 if (!console_get_event(ti->console, &ev))
     895                rc = console_get_event(ti->console, &ev);
     896                if (rc != EOK)
    894897                        return EIO;
    895898
Note: See TracChangeset for help on using the changeset viewer.