1/* 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> 12int 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} 40