- ftruncate(fd, 0);
-}
-
-static char *tf_buf = NULL;
-static int max_tf_len = 0;
-
-void
-alloc_tf_buf(void)
-{
- char dummy = '\0';
- int highest = num_test_files - 1;
- int len;
-
- len = snprintf(&dummy, 0, "%u ", highest);
- if (len < 0) {
- prterr("finding max tf_buf");
- exit(1);
- }
- tf_buf = malloc(len + 1);
- if (tf_buf == NULL) {
- prterr("allocating tf_buf");
- exit(1);
- }
- max_tf_len = sprintf(tf_buf, "%u ", highest);
-}
-
-char *
-fill_tf_buf(struct test_file *tf)
-{
- if (tf_buf == NULL)
- alloc_tf_buf();
-
- sprintf(tf_buf,"%u ", tf - test_files);
- return tf_buf;
+ if (ftruncate(fd, 0) < 0) {
+ prterr("trunc_hack: ftruncate(0) (2nd call)");
+ exit(1);
+ }