From 6e628a341ab6f7df305cf3ee041500099faaff30 Mon Sep 17 00:00:00 2001 From: Guillaume Souchere Date: Thu, 11 Apr 2024 12:38:35 +0200 Subject: [PATCH] fix(console): Fsync not propagated to secondary output Calls to fsync need to also be propagated to secondary output when CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is enabled. Closes https://github.com/espressif/esp-idf/issues/13162 --- components/esp_vfs_console/vfs_console.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/esp_vfs_console/vfs_console.c b/components/esp_vfs_console/vfs_console.c index 946c8bb6af..b071d521ad 100644 --- a/components/esp_vfs_console/vfs_console.c +++ b/components/esp_vfs_console/vfs_console.c @@ -98,7 +98,11 @@ int console_fcntl(int fd, int cmd, int arg) int console_fsync(int fd) { - return fsync(vfs_console.fd_primary); + const int ret_val = fsync(vfs_console.fd_primary); +#if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG + (void)fsync(vfs_console.fd_secondary); +#endif + return ret_val; } #ifdef CONFIG_VFS_SUPPORT_DIR