OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [sim/] [testsuite/] [sim/] [cris/] [c/] [ftruncate2.c] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/*
2
#notarget: cris*-*-elf
3
*/
4
 
5
/* Check that we get a proper error indication if trying ftruncate on a
6
   fd that is a pipe descriptor.  */
7
 
8
#include <stdio.h>
9
#include <stdlib.h>
10
#include <errno.h>
11
#include <unistd.h>
12
int main (void)
13
{
14
  int pip[2];
15
 
16
  if (pipe (pip) != 0)
17
  {
18
    perror ("pipe");
19
    abort ();
20
  }
21
 
22
  if (ftruncate (pip[0], 20) == 0 || errno != EINVAL)
23
    {
24
      perror ("ftruncate 1");
25
      abort ();
26
    }
27
 
28
  errno = 0;
29
 
30
  if (ftruncate (pip[1], 20) == 0 || errno != EINVAL)
31
    {
32
      perror ("ftruncate 2");
33
      abort ();
34
    }
35
 
36
  printf ("pass\n");
37
 
38
  exit (0);
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.