From 267c59b1f13bb26c23d7cfa28d825e991568cf2d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 23 Feb 2019 12:58:48 -0500 Subject: [PATCH] Add truncate while open --- native/jni/utils/cpio.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/native/jni/utils/cpio.cpp b/native/jni/utils/cpio.cpp index c85ad8a9b..478475d8b 100644 --- a/native/jni/utils/cpio.cpp +++ b/native/jni/utils/cpio.cpp @@ -66,8 +66,7 @@ cpio_entry::~cpio_entry() { void cpio::dump(const char *file) { fprintf(stderr, "Dump cpio: [%s]\n", file); - int fd = xopen(file, O_WRONLY | O_CREAT, 0644); - FDOutStream fd_out(fd, true); + FDOutStream fd_out(xopen(file, O_WRONLY | O_CREAT | O_TRUNC, 0644), true); output(fd_out); }