Fix tty_write to return error code (negative value) in error case

This commit is contained in:
yabu76 2025-12-30 21:04:29 +09:00
parent 5045ca1768
commit e73ff6d208
2 changed files with 2 additions and 2 deletions

View file

@ -288,7 +288,7 @@ int execute_shell_command(int fd, const char *command)
close(pipe_fd[WRITE_END]); close(pipe_fd[WRITE_END]);
while ( (bytes = read(pipe_fd[READ_END], buf, sizeof(buf))) > 0) 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"); tio_warning_printf("Could not write to tty device");
} }

View file

@ -299,7 +299,7 @@ ssize_t tty_write(int fd, void *buffer, size_t count)
{ {
// Error // Error
tio_debug_printf("Write error (%s)", strerror(errno)); tio_debug_printf("Write error (%s)", strerror(errno));
break; return retval;
} }
bytes_written += retval; bytes_written += retval;