1*4b169a6bSchristos /* Trivial test of failing writev: invalid file descriptor. 2*4b169a6bSchristos #progos: linux 3*4b169a6bSchristos */ 4*4b169a6bSchristos #include <sys/uio.h> 5*4b169a6bSchristos #include <errno.h> 6*4b169a6bSchristos #include <stdio.h> 7*4b169a6bSchristos #include <stdlib.h> 8*4b169a6bSchristos 9*4b169a6bSchristos #define X(x) {x, sizeof (x) -1} 10*4b169a6bSchristos struct iovec v[] = { 11*4b169a6bSchristos X("a"), 12*4b169a6bSchristos X("bcd"), 13*4b169a6bSchristos X("efghi"), 14*4b169a6bSchristos X("j"), 15*4b169a6bSchristos X("klmn\n"), 16*4b169a6bSchristos }; 17*4b169a6bSchristos main(void)18*4b169a6bSchristosint main (void) 19*4b169a6bSchristos { 20*4b169a6bSchristos if (writev (99, v, sizeof v / sizeof (v[0])) != -1 21*4b169a6bSchristos /* The simulator write gives EINVAL instead of EBADF; let's 22*4b169a6bSchristos cope. */ 23*4b169a6bSchristos || (errno != EBADF && errno != EINVAL)) 24*4b169a6bSchristos abort (); 25*4b169a6bSchristos 26*4b169a6bSchristos printf ("pass\n"); 27*4b169a6bSchristos return 0; 28*4b169a6bSchristos } 29