Changeset 87822ce in mainline for uspace/app/bdsh/cmds/modules/cp/cp.c


Ignore:
Timestamp:
2021-03-04T19:14:30Z (4 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/app/bdsh/cmds/modules/cp/cp.c

    r760a392 r87822ce  
    146146{
    147147        va_list args;
     148        errno_t rc;
    148149
    149150        va_start(args, message);
     
    154155                cons_event_t ev;
    155156                console_flush(con);
    156                 console_get_event(con, &ev);
     157                rc = console_get_event(con, &ev);
     158                if (rc != EOK)
     159                        exit(1);
    157160                if (ev.type != CEV_KEY || ev.ev.key.type != KEY_PRESS ||
    158161                    (ev.ev.key.mods & (KM_CTRL | KM_ALT)) != 0) {
Note: See TracChangeset for help on using the changeset viewer.