Changeset 87822ce in mainline for uspace/app/edit/edit.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/app/edit/edit.c

    r760a392 r87822ce  
    251251
    252252        while (!done) {
    253                 console_get_event(con, &ev);
     253                rc = console_get_event(con, &ev);
     254                if (rc != EOK)
     255                        break;
     256
    254257                pane.rflags = 0;
    255258
     
    634637        int nc;
    635638        bool done;
     639        errno_t rc;
    636640
    637641        asprintf(&str, "%s: %s", prompt, init_value);
     
    648652
    649653        while (!done) {
    650                 console_get_event(con, &ev);
     654                rc = console_get_event(con, &ev);
     655                if (rc != EOK)
     656                        return NULL;
    651657
    652658                if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS) {
Note: See TracChangeset for help on using the changeset viewer.