From e73ff6d208c10f601605f58037e4e96f98023024 Mon Sep 17 00:00:00 2001 From: yabu76 Date: Tue, 30 Dec 2025 21:04:29 +0900 Subject: [PATCH] Fix tty_write to return error code (negative value) in error case --- src/misc.c | 2 +- src/tty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc.c b/src/misc.c index 0df64fd..ec39f51 100644 --- a/src/misc.c +++ b/src/misc.c @@ -288,7 +288,7 @@ int execute_shell_command(int fd, const char *command) close(pipe_fd[WRITE_END]); while ( (bytes = read(pipe_fd[READ_END], buf, sizeof(buf))) > 0) { - if (tty_write(fd, buf, bytes) <= 0) + if (tty_write(fd, buf, bytes) < 0) { tio_warning_printf("Could not write to tty device"); } diff --git a/src/tty.c b/src/tty.c index 8191e0c..2bfad11 100644 --- a/src/tty.c +++ b/src/tty.c @@ -299,7 +299,7 @@ ssize_t tty_write(int fd, void *buffer, size_t count) { // Error tio_debug_printf("Write error (%s)", strerror(errno)); - break; + return retval; } bytes_written += retval;