bad_pipe

bad_pipe - char *ptr; ptr = (char *)&fds[0];...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * pipe */ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <err.h> #include "config.h" #include "test.h" static void pipe_badptr(void *ptr, const char *desc) { int rv; rv = pipe(ptr); report_test(rv, errno, EFAULT, desc); } static void pipe_unaligned(void) { int fds[3], rv;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: char *ptr; ptr = (char *)&amp;fds[0]; ptr++; rv = pipe((int *)ptr); report_survival(rv, errno, &quot;pipe with unaligned pointer&quot;); } void test_pipe(void) { pipe_badptr(NULL, &quot;pipe with NULL pointer&quot;); pipe_badptr(INVAL_PTR, &quot;pipe with invalid pointer&quot;); pipe_badptr(KERN_PTR, &quot;pipe with kernel pointer&quot;); pipe_unaligned(); }...
View Full Document

Ask a homework question - tutors are online