diff options
author | 2011-06-08 20:09:31 -0700 | |
---|---|---|
committer | 2011-06-08 20:11:49 -0700 | |
commit | 61334a3f831ecd5ad7b91a2b81532f5caffb1307 (patch) | |
tree | 3cc224ea0317387c64e5dc6e835ad889ac36f793 | |
parent | 5f3274036c5d8cf879eacfac323f9622d15d343f (diff) |
Fix handling of directory entries
Don't emit tar blocks for directories with an invalid nonzero size. Also, if
such an entry is encountered during restore, don't actually attempt to treat
it as valid and thus skip over the next actual tar entry.
This patch also adds tracking of the data actually consumed during restore,
and reports a total at the end of stream.
Change-Id: I625173f76df3c007e899209101ff2b587841f184
-rw-r--r-- | libs/utils/BackupHelpers.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/utils/BackupHelpers.cpp b/libs/utils/BackupHelpers.cpp index f933199fe8..87549fe977 100644 --- a/libs/utils/BackupHelpers.cpp +++ b/libs/utils/BackupHelpers.cpp @@ -525,6 +525,7 @@ int write_tarfile(const String8& packageName, const String8& domain, String8 prefix; const int isdir = S_ISDIR(s.st_mode); + if (isdir) s.st_size = 0; // directories get no actual data in the tar stream // !!! TODO: use mmap when possible to avoid churning the buffer cache // !!! TODO: this will break with symlinks; need to use readlink(2) |