summaryrefslogtreecommitdiff
path: root/nuttx/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-04 15:12:42 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-11-04 15:12:42 +0000
commit17ca1ae40a71c8acd127856b4baa104953864327 (patch)
tree0bcfca2628007ea8f047530724859184625f665b /nuttx/examples
parent0128ca6d623d5539c7e1ef87997a794674165149 (diff)
downloadpx4-nuttx-17ca1ae40a71c8acd127856b4baa104953864327.tar.gz
px4-nuttx-17ca1ae40a71c8acd127856b4baa104953864327.tar.bz2
px4-nuttx-17ca1ae40a71c8acd127856b4baa104953864327.zip
Exit after reading EOF
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2221 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples')
-rw-r--r--nuttx/examples/usbserial/host.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nuttx/examples/usbserial/host.c b/nuttx/examples/usbserial/host.c
index 235d1f402..f0235ec20 100644
--- a/nuttx/examples/usbserial/host.c
+++ b/nuttx/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;
}