1 /* Verifies that a deleted file may still be written to and read
8 #include "tests/main.h"
16 const char *filename = "deleteme";
19 CHECK (create (filename, sizeof buf1), "create \"%s\"", filename);
20 CHECK ((fd = open (filename)) > 1, "open \"%s\"", filename);
21 CHECK (remove (filename), "remove \"%s\"", filename);
22 random_bytes (buf1, sizeof buf1);
23 CHECK (write (fd, buf1, sizeof buf1) > 0, "write \"%s\"", filename);
24 msg ("seek \"%s\" to 0", filename);
26 CHECK (read (fd, buf2, sizeof buf2) > 0, "read \"%s\"", filename);
27 compare_bytes (buf2, buf1, sizeof buf1, 0, filename);
28 msg ("close \"%s\"", filename);