summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-25 00:01:08 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-25 00:01:08 +0000
commit1520663dd52c25496f285eb2e08077318c600759 (patch)
treed518e0fc4392bc0990718a7692e3b09a0934b79a /apps
parent2a8490551299ccfdfa300c1b859719c08581e553 (diff)
downloadnuttx-1520663dd52c25496f285eb2e08077318c600759.tar.gz
nuttx-1520663dd52c25496f285eb2e08077318c600759.tar.bz2
nuttx-1520663dd52c25496f285eb2e08077318c600759.zip
Fix some compilation errors when child status disabled; new waitpid logic not encoding/decoding status properly
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5561 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps')
-rw-r--r--apps/ChangeLog.txt2
-rw-r--r--apps/examples/ostest/waitpid.c18
2 files changed, 11 insertions, 9 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt
index 5f3440897..494ce34eb 100644
--- a/apps/ChangeLog.txt
+++ b/apps/ChangeLog.txt
@@ -493,3 +493,5 @@
* apps/netutils/telnetd/telnetd_driver: Was stuck in a loop if
recv[from]() ever returned a value <= 0.
* apps/examples/nettest and poll: Complete Kconfig files.
+ * apps/examples/ostest/waitpid.c: Need to use WEXITSTATUS()
+ to decode the correct exit status.
diff --git a/apps/examples/ostest/waitpid.c b/apps/examples/ostest/waitpid.c
index e53b49213..d45410265 100644
--- a/apps/examples/ostest/waitpid.c
+++ b/apps/examples/ostest/waitpid.c
@@ -113,14 +113,14 @@ static void waitpid_last(void)
printf("waitpid_last: ERROR: PID %d waitpid failed: %d\n",
g_waitpids[NCHILDREN-1], errcode);
}
- else if (stat_loc != RETURN_STATUS)
+ else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
{
printf("waitpid_last: ERROR: PID %d return status is %d, expected %d\n",
- g_waitpids[NCHILDREN-1], stat_loc, RETURN_STATUS);
+ g_waitpids[NCHILDREN-1], WEXITSTATUS(stat_loc), RETURN_STATUS);
}
else
{
- printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%d\n",
+ printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%04x\n",
g_waitpids[NCHILDREN-1], stat_loc);
}
}
@@ -155,14 +155,14 @@ int waitpid_test(void)
printf("waitpid_test: ERROR: PID %d wait returned PID %d\n",
g_waitpids[0], ret);
}
- else if (stat_loc != RETURN_STATUS)
+ else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
{
printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n",
- g_waitpids[0], stat_loc, RETURN_STATUS);
+ g_waitpids[0], WEXITSTATUS(stat_loc), RETURN_STATUS);
}
else
{
- printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%d\n",
+ printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%04x\n",
g_waitpids[0], stat_loc);
}
@@ -246,14 +246,14 @@ int waitpid_test(void)
int errcode = errno;
printf("waitpid_test: ERROR: wait failed: %d\n", errcode);
}
- else if (stat_loc != RETURN_STATUS)
+ else if (WEXITSTATUS(stat_loc) != RETURN_STATUS)
{
printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n",
- ret, stat_loc, RETURN_STATUS);
+ ret, WEXITSTATUS(stat_loc), RETURN_STATUS);
}
else
{
- printf("waitpid_test: PID %d wait succeeded with stat_loc=%d\n",
+ printf("waitpid_test: PID %d wait succeeded with stat_loc=%04x\n",
ret, stat_loc);
}