bad_ftruncate - close(fd); } static void...

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

View Full Document Right Arrow Icon
/* * ftruncate */ #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 ftruncate_fd_device(void) { int rv, fd; fd = open("null:", O_RDWR); if (fd<0) { warn("UH-OH: opening null: failed"); return; } rv = ftruncate(fd, 6); report_test(rv, errno, EINVAL, "ftruncate on device");
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: close(fd); } static void ftruncate_size_neg(void) { int rv, fd; fd = open_testfile(0); if (fd<0) { return; } rv = ftruncate(fd, -60); report_test(rv, errno, EINVAL, "ftruncate to negative size"); close(fd); remove(TESTFILE); } void test_ftruncate(void) { test_ftruncate_fd(); ftruncate_fd_device(); ftruncate_size_neg(); }...
View Full Document

This note was uploaded on 11/10/2009 for the course CS 536 taught by Professor Lums during the Spring '09 term at Indiana.

Page1 / 2

bad_ftruncate - close(fd); } static void...

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

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