/* Tests for copy_file_range.
- Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ Copyright (C) 2017-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <support/temp_file.h>
#include <support/test-driver.h>
#include <support/xunistd.h>
-#include <sys/mount.h>
+#ifdef CLONE_NEWNS
+# include <sys/mount.h>
+#endif
/* Boolean flags which indicate whether to use pointers with explicit
output flags. */
*p = rand () >> 24;
infd = create_temp_file ("tst-copy_file_range-in-", &infile);
- xclose (create_temp_file ("tst-copy_file_range-out-", &outfile));
+ {
+ int outfd = create_temp_file ("tst-copy_file_range-out-", &outfile);
+ if (!support_descriptor_supports_holes (outfd))
+ FAIL_UNSUPPORTED ("File %s does not support holes", outfile);
+ xclose (outfd);
+ }
/* Try to find a different directory from the default input/output
file. */