summaryrefslogtreecommitdiff
path: root/test/unistd/errno.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/unistd/errno.c')
-rw-r--r--test/unistd/errno.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unistd/errno.c b/test/unistd/errno.c
new file mode 100644
index 000000000..746c21d89
--- /dev/null
+++ b/test/unistd/errno.c
@@ -0,0 +1,27 @@
+/* based originally on one the clone tests in the LTP */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sched.h>
+
+int child_fn(void *arg)
+{
+ fprintf(stderr, "in child_fn\n");
+ exit(1);
+}
+
+int main(void)
+{
+ int r_clone, ret_errno;
+
+ r_clone = clone(child_fn, NULL, (int) NULL, NULL);
+ ret_errno = errno;
+ if (ret_errno != EINVAL) {
+ fprintf(stderr, "clone: res=%d (%d) errno=%d %m\n",
+ r_clone, (int) NULL, errno);
+ return 1;
+ }
+
+ return 0;
+}