aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/cris/c/writev2.c
blob: 5cb92b60a5e1ce73b219f2f69bd576d056efae21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Trivial test of failing writev: invalid file descriptor.
#notarget: cris*-*-elf
*/
#include <sys/uio.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

#define X(x) {x, sizeof (x) -1}
struct iovec v[] = {
  X("a"),
  X("bcd"),
  X("efghi"),
  X("j"),
  X("klmn\n"),
};

int main (void)
{
  if (writev (99, v, sizeof v / sizeof (v[0])) != -1
      /* The simulator write gives EINVAL instead of EBADF; let's
	 cope.  */
      || (errno != EBADF && errno != EINVAL))
    abort ();

  printf ("pass\n");
  return 0; 
}