summaryrefslogtreecommitdiff
path: root/apps/examples/posix_spawn/spawn_main.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-11 19:08:51 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-11 19:08:51 +0000
commit049b66a75a6f7795b5e80ce70122479f2ef31586 (patch)
tree2af089980e448cc2cf6ae01d884acb23f26f6d88 /apps/examples/posix_spawn/spawn_main.c
parent7272d1e7473fc1ce1d0a29c7287260402ca2420e (diff)
downloadnuttx-049b66a75a6f7795b5e80ce70122479f2ef31586.tar.gz
nuttx-049b66a75a6f7795b5e80ce70122479f2ef31586.tar.bz2
nuttx-049b66a75a6f7795b5e80ce70122479f2ef31586.zip
Fix an error handling bug in the fread logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5511 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/posix_spawn/spawn_main.c')
-rw-r--r--apps/examples/posix_spawn/spawn_main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c
index 6f8859516..1506fe499 100644
--- a/apps/examples/posix_spawn/spawn_main.c
+++ b/apps/examples/posix_spawn/spawn_main.c
@@ -89,6 +89,15 @@
# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file"
#endif
+/* The redirection test does not work. This is because it tries to redirect
+ * file as stdin. That won't work now because (1) the file descriptors must
+ * be dup'ed when the new task is created, and (2) there is no support in
+ * place for dup'ing file descriptors for anything other than sockets and
+ * character drivers. This is a bug!
+ */
+
+#define FILE_DUP_BUG 1
+
/* Describe the ROMFS file system */
#define SECTORSIZE 512
@@ -138,7 +147,9 @@ static unsigned int g_mmstep; /* Memory Usage at beginning of test step */
static const char delimiter[] =
"****************************************************************************";
+#ifndef FILE_DUP_BUG
static const char g_redirect[] = "redirect";
+#endif
static const char g_hello[] = "hello";
static const char g_data[] = "testdata.txt";
@@ -361,9 +372,11 @@ int spawn_main(int argc, char *argv[])
mm_update(&g_mmstep, "after file_action/attr destruction");
/*************************************************************************
- * Case 2: Simple program with redirection of stdin
+ * Case 2: Simple program with redirection of stdin to a file input
*************************************************************************/
+#ifndef FILE_DUP_BUG
+
/* Output a seperated so that we can clearly discriminate the output of
* this program from the others.
*/
@@ -450,6 +463,7 @@ int spawn_main(int argc, char *argv[])
posix_spawnattr_dump(&attr);
mm_update(&g_mmstep, "after file_action/attr destruction");
+#endif
/* Clean-up */