1 /* Check for a sim bug, whereby the position was always unsigned
2 (truncation instead of sign-extension for 64-bit hosts). */
15 const char fname[] = "sk1test.dat";
17 = "A random line of text, used to test correct read, write and seek.\n";
18 char buf[sizeof tsttxt] = "";
19 const char correct[] = "correct";
20 char buf2[sizeof correct] = {0};
23 f = fopen (fname, "wb");
25 || fwrite (tsttxt, 1, strlen (tsttxt), f) != strlen (tsttxt)
32 /* We have to use file-descriptor calls instead of stream calls to
33 provoke the bug (for stream calls, the lseek call is canonicalized
35 fd = open (fname, O_RDONLY);
37 || read (fd, buf, strlen (tsttxt)) != strlen (tsttxt)
38 || strcmp (buf, tsttxt) != 0
39 || lseek (fd, -30L, SEEK_CUR) != 36
40 || read (fd, buf2, strlen (correct)) != strlen (correct)
41 || strcmp (buf2, correct) != 0)