URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 24 |
Rev 157 |
/*
|
/*
|
#notarget: cris*-*-elf
|
#notarget: cris*-*-elf
|
*/
|
*/
|
|
|
/* Check that we get a proper error indication if trying ftruncate on a
|
/* Check that we get a proper error indication if trying ftruncate on a
|
fd that is a pipe descriptor. */
|
fd that is a pipe descriptor. */
|
|
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <errno.h>
|
#include <errno.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
int main (void)
|
int main (void)
|
{
|
{
|
int pip[2];
|
int pip[2];
|
|
|
if (pipe (pip) != 0)
|
if (pipe (pip) != 0)
|
{
|
{
|
perror ("pipe");
|
perror ("pipe");
|
abort ();
|
abort ();
|
}
|
}
|
|
|
if (ftruncate (pip[0], 20) == 0 || errno != EINVAL)
|
if (ftruncate (pip[0], 20) == 0 || errno != EINVAL)
|
{
|
{
|
perror ("ftruncate 1");
|
perror ("ftruncate 1");
|
abort ();
|
abort ();
|
}
|
}
|
|
|
errno = 0;
|
errno = 0;
|
|
|
if (ftruncate (pip[1], 20) == 0 || errno != EINVAL)
|
if (ftruncate (pip[1], 20) == 0 || errno != EINVAL)
|
{
|
{
|
perror ("ftruncate 2");
|
perror ("ftruncate 2");
|
abort ();
|
abort ();
|
}
|
}
|
|
|
printf ("pass\n");
|
printf ("pass\n");
|
|
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.