From 4f5791ebd03eaec1c7da0865a383175b05102712 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 19:47:29 +0200 Subject: Adding upstream version 2:4.17.12+dfsg. Signed-off-by: Daniel Baumann --- tests/ftruncate.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/ftruncate.c (limited to 'tests/ftruncate.c') diff --git a/tests/ftruncate.c b/tests/ftruncate.c new file mode 100644 index 0000000..4612376 --- /dev/null +++ b/tests/ftruncate.c @@ -0,0 +1,31 @@ +/* test whether ftruncte() can extend a file */ + +#if defined(HAVE_UNISTD_H) +#include +#endif + +#include +#include +#include + +#define DATA "conftest.trunc" +#define LEN 7663 + +int main(void) +{ + int *buf; + int fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666); + + if (fd == -1) { + exit(1); + } + + ftruncate(fd, LEN); + + unlink(DATA); + + if (lseek(fd, 0, SEEK_END) == LEN) { + exit(0); + } + exit(1); +} -- cgit v1.2.3