git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ec0fe45
)
capitests: Use ftruncate instead of seek + write to create test files.
author
Richard W.M. Jones
<rjones@redhat.com>
Wed, 3 Nov 2010 17:37:07 +0000
(17:37 +0000)
committer
Richard W.M. Jones
<rjones@redhat.com>
Wed, 3 Nov 2010 17:44:30 +0000
(17:44 +0000)
generator/generator_capitests.ml
patch
|
blob
|
history
diff --git
a/generator/generator_capitests.ml
b/generator/generator_capitests.ml
index
6f5f59c
..
325b37c
100644
(file)
--- 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);
}
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);
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
@@
-209,14
+203,8
@@
int main (int argc, char *argv[])
perror (filename);
exit (EXIT_FAILURE);
}
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);
close (fd);
unlink (filename);
exit (EXIT_FAILURE);
@@
-237,14
+225,8
@@
int main (int argc, char *argv[])
perror (filename);
exit (EXIT_FAILURE);
}
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);
close (fd);
unlink (filename);
exit (EXIT_FAILURE);