Update ramdisk restore implementation

This commit is contained in:
topjohnwu
2022-06-08 23:23:39 -07:00
parent 89ff3c6572
commit 3a39dd4049
3 changed files with 38 additions and 29 deletions

View File

@@ -53,7 +53,9 @@ void cpio::dump(const char *file) {
dump(xfopen(file, "we"));
}
void cpio::rm(entry_map::iterator &it) {
void cpio::rm(entry_map::iterator it) {
if (it == entries.end())
return;
fprintf(stderr, "Remove [%s]\n", it->first.data());
entries.erase(it);
}
@@ -188,7 +190,7 @@ void cpio::ln(const char *target, const char *name) {
fprintf(stderr, "Create symlink [%s] -> [%s]\n", name, target);
}
void cpio::mv(entry_map::iterator &it, const char *name) {
void cpio::mv(entry_map::iterator it, const char *name) {
fprintf(stderr, "Move [%s] -> [%s]\n", it->first.data(), name);
auto e = it->second.release();
entries.erase(it);