X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=generator%2Fgenerator_capitests.ml;h=325b37c5c8bfa8f9f95e2f6f28736a1f014bdb3b;hp=6f5f59c7f3db7d2f81aeef02963de993cccdfd62;hb=bf3b9e2e236b4dd2216200993ba39545ad5160bb;hpb=ec0fe45e48fa4621fc6fa0f5bcc44f184068c86f diff --git a/generator/generator_capitests.ml b/generator/generator_capitests.ml index 6f5f59c..325b37c 100644 --- a/generator/generator_capitests.ml +++ b/generator/generator_capitests.ml @@ -181,14 +181,8 @@ int main (int argc, char *argv[]) perror (filename); exit (EXIT_FAILURE); } - if (lseek (fd, %d, SEEK_SET) == -1) { - perror (\"lseek\"); - close (fd); - unlink (filename); - exit (EXIT_FAILURE); - } - if (write (fd, &c, 1) == -1) { - perror (\"write\"); + if (ftruncate (fd, %d) == -1) { + perror (\"ftruncate\"); close (fd); unlink (filename); exit (EXIT_FAILURE); @@ -209,14 +203,8 @@ int main (int argc, char *argv[]) perror (filename); exit (EXIT_FAILURE); } - if (lseek (fd, %d, SEEK_SET) == -1) { - perror (\"lseek\"); - close (fd); - unlink (filename); - exit (EXIT_FAILURE); - } - if (write (fd, &c, 1) == -1) { - perror (\"write\"); + if (ftruncate (fd, %d) == -1) { + perror (\"ftruncate\"); close (fd); unlink (filename); exit (EXIT_FAILURE); @@ -237,14 +225,8 @@ int main (int argc, char *argv[]) perror (filename); exit (EXIT_FAILURE); } - if (lseek (fd, %d, SEEK_SET) == -1) { - perror (\"lseek\"); - close (fd); - unlink (filename); - exit (EXIT_FAILURE); - } - if (write (fd, &c, 1) == -1) { - perror (\"write\"); + if (ftruncate (fd, %d) == -1) { + perror (\"ftruncate\"); close (fd); unlink (filename); exit (EXIT_FAILURE);