diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-03 11:13:51 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-03 11:13:51 +0000 |
| commit | 79945419ebcfacf05d3c152c8ca070ca8f75817f (patch) | |
| tree | 301bafc841a7c813a278dba7e73bb2e34b538637 /terminal.c | |
| parent | server: set CLOEXEC | NONBLOCK directly in socket() call (diff) | |
terminal: comments and cleanup
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -60,6 +60,11 @@ term_to_slave(struct terminal *term, const void *_data, size_t len) goto enqueue_data; } + /* + * Try a synchronous write first. If we fail to write everything, + * switch to asynchronous. + */ + switch (to_slave(term, _data, len, &(size_t){0})) { case PTMX_WRITE_REMAIN: if (!fdm_event_add(term->fdm, term->ptmx, EPOLLOUT)) @@ -70,6 +75,10 @@ term_to_slave(struct terminal *term, const void *_data, size_t len) case PTMX_WRITE_ERR: return false; } + /* Shouldn't get here */ + assert(false); + return false; + enqueue_data: { void *copy = malloc(len); |
