Skip to content

Commit

Permalink
protocol: cleanup unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Mar 11, 2021
1 parent 480da6d commit 21b9aef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,7 @@ int callback_tty(struct lws *wsi, enum lws_callback_reasons reason, void *user,
switch (command) {
case INPUT:
if (server->readonly) break;

char *data = xmalloc(pss->len - 1);
memcpy(data, pss->buffer + 1, pss->len - 1);

uv_write_t *req = xmalloc(sizeof(uv_write_t));
req->data = data;

int err = pty_write(pss->process, pty_buf_init(data, pss->len - 1));
int err = pty_write(pss->process, pty_buf_init(pss->buffer + 1, pss->len - 1));
if (err) {
lwsl_err("uv_write: %s (%s)\n", uv_err_name(err), uv_strerror(err));
return -1;
Expand Down
5 changes: 4 additions & 1 deletion src/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ void pty_resume(pty_process *process) {
}

int pty_write(pty_process *process, pty_buf_t *buf) {
if (process == NULL) return UV_ESRCH;
if (process == NULL) {
pty_buf_free(buf);
return UV_ESRCH;
}
pty_io_t *io = process->io;
uv_buf_t b = uv_buf_init(buf->base, buf->len);
uv_write_t *req = xmalloc(sizeof(uv_write_t));
Expand Down

0 comments on commit 21b9aef

Please sign in to comment.