Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tools: flterm: check logfd, check ascii, flush each line

  • Loading branch information...
commit 9aa4a6045c90d75ed71872162d73fdaa35557f63 1 parent 2353955
Xiangfu Liu authored sbourdeauducq committed
Showing with 5 additions and 2 deletions.
  1. +5 −2 tools/flterm.c
View
7 tools/flterm.c
@@ -24,6 +24,7 @@
#include <sys/ioctl.h>
#include <sys/time.h>
#include <string.h>
+#include <ctype.h>
#include <termios.h>
#include <fcntl.h>
#include <unistd.h>
@@ -492,8 +493,10 @@ static void do_terminal(char *serial_port,
if(fds[1].revents & POLLIN) {
if(read(serialfd, &c, 1) <= 0) break;
- fwrite(&c, sizeof(c), 1, logfd);
- fflush(logfd);
+ if(logfd != NULL) {
+ if(isascii(c)) fwrite(&c, sizeof(c), 1, logfd);
+ if(c == '\n') fflush(logfd);
+ }
if(gdbfd != -1 && rsp_pending && (c == '+' || c == '-')) {
rsp_pending = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.