- protect calls to fork/sleep/kill with _POSIX_VERSION
- protect inclusion of sys/wait.h with #if HAVE_SYS_WAIT_H
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@462
64e312b2-a51f-0410-8e61-
82d0ca0eb02a
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
+#include "config.h"
#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif /* HAVE_SYS_WAIT_H */
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
#include <check.h>
#include "check_check.h"
-
-
-
START_TEST(test_lno)
{
fail("Failure expected"); /* line 18*/
{
pid_t pid;
+#ifdef _POSIX_VERSION
if((pid = fork()) < 0) {
fail("Failed to fork new process");
} else if (pid > 0) {
+#endif /* _POSIX_VERSION */
fail_unless(1, NULL);
+#ifdef _POSIX_VERSION
kill(pid, SIGKILL);
} else {
for (;;) {
sleep(1);
}
}
+#endif /* _POSIX_VERSION */
}
END_TEST
{
pid_t pid;
+#ifdef _POSIX_VERSION
if((pid = fork()) < 0) {
fail("Failed to fork new process");
} else if (pid > 0) {
+#endif /* _POSIX_VERSION */
fail("Expected fail");
+#ifdef _POSIX_VERSION
kill(pid, SIGKILL);
} else {
for (;;) {
sleep(1);
}
}
+#endif /* _POSIX_VERSION */
}
END_TEST