---
pxzcat.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pxzcat.c b/pxzcat.c
index 4ab8689..9bcdc36 100644
--- a/pxzcat.c
+++ b/pxzcat.c
@@ -29,10 +29,11 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+#define _GNU_SOURCE
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -166,12 +167,12 @@ xzfile_uncompress (const char *filename, const
char *outputfile,
debug ("uncompressed size = %" PRIu64 " bytes", size);
ofd = open (outputfile, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0644);
if (ofd == -1)
error (EXIT_FAILURE, errno, "open: %s", outputfile);
- if (ftruncate (ofd, size) == -1)
- error (EXIT_FAILURE, errno, "ftruncate: %s", outputfile);
+ if (fallocate (ofd, 0, 0, size) == -1)
+ error (EXIT_FAILURE, errno, "fallocate: %s", outputfile);
/* Tell the kernel we won't read the output file. */
posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM|POSIX_FADV_DONTNEED);
/* Iterate over blocks. */
--
1.8.4.1.563.g8e6fc32