clang-format
This commit is contained in:
@@ -43,53 +43,45 @@
|
||||
#include "config.h"
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
void
|
||||
ftruncate_fd_device(void)
|
||||
{
|
||||
int rv, fd;
|
||||
static void ftruncate_fd_device(void) {
|
||||
int rv, fd;
|
||||
|
||||
report_begin("ftruncate on device");
|
||||
report_begin("ftruncate on device");
|
||||
|
||||
fd = open("null:", O_RDWR);
|
||||
if (fd<0) {
|
||||
report_warn("opening null: failed");
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
fd = open("null:", O_RDWR);
|
||||
if (fd < 0) {
|
||||
report_warn("opening null: failed");
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ftruncate(fd, 6);
|
||||
report_check(rv, errno, EINVAL);
|
||||
rv = ftruncate(fd, 6);
|
||||
report_check(rv, errno, EINVAL);
|
||||
|
||||
close(fd);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
ftruncate_size_neg(void)
|
||||
{
|
||||
int rv, fd;
|
||||
static void ftruncate_size_neg(void) {
|
||||
int rv, fd;
|
||||
|
||||
report_begin("ftruncate to negative size");
|
||||
report_begin("ftruncate to negative size");
|
||||
|
||||
fd = open_testfile(NULL);
|
||||
if (fd<0) {
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
fd = open_testfile(NULL);
|
||||
if (fd < 0) {
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ftruncate(fd, -60);
|
||||
report_check(rv, errno, EINVAL);
|
||||
rv = ftruncate(fd, -60);
|
||||
report_check(rv, errno, EINVAL);
|
||||
|
||||
close(fd);
|
||||
remove(TESTFILE);
|
||||
close(fd);
|
||||
remove(TESTFILE);
|
||||
}
|
||||
|
||||
void
|
||||
test_ftruncate(void)
|
||||
{
|
||||
test_ftruncate_fd();
|
||||
void test_ftruncate(void) {
|
||||
test_ftruncate_fd();
|
||||
|
||||
ftruncate_fd_device();
|
||||
ftruncate_size_neg();
|
||||
ftruncate_fd_device();
|
||||
ftruncate_size_neg();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user