From 0169e90e8488b1af029486e7215600c87a014fa3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 08:55:05 +0200 Subject: libio: Do simple parameter checks early This simplifies error handling later. Update #3132. --- testsuites/psxtests/psxfile02/init.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'testsuites') diff --git a/testsuites/psxtests/psxfile02/init.c b/testsuites/psxtests/psxfile02/init.c index fe74fec7d5..d66815203a 100644 --- a/testsuites/psxtests/psxfile02/init.c +++ b/testsuites/psxtests/psxfile02/init.c @@ -41,10 +41,16 @@ void do_with_fd( ) { struct stat stat_buff; - struct iovec vec[4]; + struct iovec vec[2]; + char buf[2][1]; off_t res; int status; + vec[0].iov_base = buf[0]; + vec[0].iov_len = sizeof(buf[0]); + vec[1].iov_base = buf[1]; + vec[1].iov_len = sizeof(buf[1]); + printf("ftruncate %s\n", description); status = ftruncate(fd, 40); rtems_test_assert( status == -1 ); @@ -88,13 +94,13 @@ void do_with_fd( rtems_test_assert( errno == EBADF ); printf("readv %s\n", description); - status = readv(fd, vec, 4); + status = readv(fd, vec, 2); rtems_test_assert( status == -1 ); printf( "%d: %s\n", errno, strerror( errno ) ); rtems_test_assert( errno == EBADF ); printf("writev %s\n", description); - status = writev(fd, vec, 4); + status = writev(fd, vec, 2); rtems_test_assert( status == -1 ); printf( "%d: %s\n", errno, strerror( errno ) ); rtems_test_assert( errno == EBADF ); -- cgit v1.2.3