clang-format
This commit is contained in:
@@ -43,44 +43,36 @@
|
||||
#include "config.h"
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
void
|
||||
pipe_badptr(void *ptr, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
static void pipe_badptr(void *ptr, const char *desc) {
|
||||
int rv;
|
||||
|
||||
report_begin("%s", desc);
|
||||
rv = pipe(ptr);
|
||||
report_check(rv, errno, EFAULT);
|
||||
report_begin("%s", desc);
|
||||
rv = pipe(ptr);
|
||||
report_check(rv, errno, EFAULT);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
pipe_unaligned(void)
|
||||
{
|
||||
int fds[3], rv;
|
||||
char *ptr;
|
||||
static void pipe_unaligned(void) {
|
||||
int fds[3], rv;
|
||||
char *ptr;
|
||||
|
||||
report_begin("pipe with unaligned pointer");
|
||||
report_begin("pipe with unaligned pointer");
|
||||
|
||||
ptr = (char *)&fds[0];
|
||||
ptr++;
|
||||
ptr = (char *)&fds[0];
|
||||
ptr++;
|
||||
|
||||
rv = pipe((int *)ptr);
|
||||
report_survival(rv, errno);
|
||||
if (rv == 0) {
|
||||
memmove(fds, ptr, 2*sizeof(int));
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
}
|
||||
rv = pipe((int *)ptr);
|
||||
report_survival(rv, errno);
|
||||
if (rv == 0) {
|
||||
memmove(fds, ptr, 2 * sizeof(int));
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_pipe(void)
|
||||
{
|
||||
pipe_badptr(NULL, "pipe with NULL pointer");
|
||||
pipe_badptr(INVAL_PTR, "pipe with invalid pointer");
|
||||
pipe_badptr(KERN_PTR, "pipe with kernel pointer");
|
||||
void test_pipe(void) {
|
||||
pipe_badptr(NULL, "pipe with NULL pointer");
|
||||
pipe_badptr(INVAL_PTR, "pipe with invalid pointer");
|
||||
pipe_badptr(KERN_PTR, "pipe with kernel pointer");
|
||||
|
||||
pipe_unaligned();
|
||||
pipe_unaligned();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user