diff --git a/examples/usbserial/host.c b/examples/usbserial/host.c index 235d1f4021..f0235ec201 100644 --- a/examples/usbserial/host.c +++ b/examples/usbserial/host.c @@ -237,6 +237,11 @@ int main(int argc, char **argv, char **envp) close(fd); return 2; } + else if (nbytes == 0) + { + printf("main: End-of-file encountereDs\n"); + break; + } g_iobuffer[nbytes] = '\0'; printf("main: Received %d bytes:\n", nbytes); @@ -282,8 +287,6 @@ int main(int argc, char **argv, char **envp) #endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ } - /* Won't get here, but if we did this what we would have to do */ - close(fd); return 0; }