common_buf

common_buf - /* * Calls with invalid transfer buffers */...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * Calls with invalid transfer buffers */ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <limits.h> #include <errno.h> #include <err.h> #include "config.h" #include "test.h" static int buf_fd; struct buftest { int (*setup)(void); int (*op)(void *); void (*cleanup)(void); const char *name; }; //////////////////////////////////////////////////////////// static int read_setup(void) { buf_fd = open_testfile("i do not like green eggs and ham"); if (buf_fd<0) { return -1; } return 0; } static int read_badbuf(void *buf) { return read(buf_fd, buf, 128); } static void read_cleanup(void) { close(buf_fd); remove(TESTFILE); } ////////// static int write_setup(void)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
{ buf_fd = open_testfile(NULL); if (buf_fd<0) { return -1; } return 0; } static int write_badbuf(void *ptr) { return write(buf_fd, ptr, 128); } static void write_cleanup(void) { close(buf_fd); remove(TESTFILE); } ////////// static int getdirentry_setup(void)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

common_buf - /* * Calls with invalid transfer buffers */...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online