summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-13 08:55:05 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-15 07:33:43 +0200
commit0169e90e8488b1af029486e7215600c87a014fa3 (patch)
tree0998a30e8a4c452cea2a20a45815d106229b3aeb /testsuites
parentlibio: Avoid direct use of rtems_libio_iops (diff)
downloadrtems-0169e90e8488b1af029486e7215600c87a014fa3.tar.bz2
libio: Do simple parameter checks early
This simplifies error handling later. Update #3132.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/psxfile02/init.c12
1 files changed, 9 insertions, 3 deletions
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 );