1 /* Check that the truncate syscall works trivially.
16 const char fname[] = PREFIX "sk1test.dat";
18 = "This is the first and only line of this file.\n";
19 const char tsttxt2[] = "Now there is a second line.\n";
20 char buf[sizeof (tsttxt1) + sizeof (tsttxt2) - 1] = "";
22 f = fopen (fname, "w+");
24 || fwrite (tsttxt1, 1, strlen (tsttxt1), f) != strlen (tsttxt1)
31 if (truncate (fname, strlen(tsttxt1) - 10) != 0)
37 f = fopen (fname, "r");
39 || fread (buf, 1, sizeof (buf), f) != strlen (tsttxt1) - 10
40 || strncmp (buf, tsttxt1, strlen (tsttxt1) - 10) != 0