diff --git a/src/protocol.c b/src/protocol.c index 809cac6..2985f3c 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -110,7 +110,7 @@ static bool spawn_process(struct pss_tty *pss, uint16_t columns, uint16_t rows) char *filePath = xmalloc(file_path_len); snprintf(filePath, file_path_len, "%sXXXXXX", server->arg_file); - if ((fd = mkstemp(filePath)) != -1) { + if ((fd = mkstemp(filePath)) == -1) { lwsl_err("Creation of temp file failed with error: %d (%s)\n", errno, strerror(errno)); return false; } @@ -124,7 +124,7 @@ static bool spawn_process(struct pss_tty *pss, uint16_t columns, uint16_t rows) if (close(fd) != 0) { lwsl_err("Close temp file failed with error: %d (%s)\n", errno, strerror(errno)); - return false + return false; } argv[n++] = filePath; } @@ -166,7 +166,7 @@ static void wsi_output(struct lws *wsi, pty_buf_t *buf) { int callback_tty(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len) { struct pss_tty *pss = (struct pss_tty *)user; - char buf[256]; + char buf[1024]; size_t n = 0; switch (reason) {