Commit 267c59b1 authored by topjohnwu's avatar topjohnwu

Add truncate while open

parent 2ab17204
...@@ -66,8 +66,7 @@ cpio_entry::~cpio_entry() { ...@@ -66,8 +66,7 @@ cpio_entry::~cpio_entry() {
void cpio::dump(const char *file) { void cpio::dump(const char *file) {
fprintf(stderr, "Dump cpio: [%s]\n", file); fprintf(stderr, "Dump cpio: [%s]\n", file);
int fd = xopen(file, O_WRONLY | O_CREAT, 0644); FDOutStream fd_out(xopen(file, O_WRONLY | O_CREAT | O_TRUNC, 0644), true);
FDOutStream fd_out(fd, true);
output(fd_out); output(fd_out);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment