diff options
author | Lei YU <mine260309@gmail.com> | 2019-03-08 16:41:51 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2019-04-02 10:32:49 +0800 |
commit | 5d9302860ff4b064ae09bb91683cb7fa00ba7450 (patch) | |
tree | f20a0f3293ecdc13f61b1bf2e5a90f31b6658e7d /image_verify.cpp | |
parent | ab8231c66364286a10b0da6d64d9742752323b4d (diff) | |
download | phosphor-bmc-code-mgmt-master.tar.gz phosphor-bmc-code-mgmt-master.zip |
The code in processImage() execute "tar xf" twice, the first time to
extract the MANIFEST, and the second time to extract the whole tarball.
On a tarball without compression, it's OK. But if the tarball is
compressed, it takes much longer time to de-compress the tarball for
twice.
This commit changes the behavior by:
1. Untar the whole tarball into a temp dir;
2. Parse the manifest as before;
3. If something is wrong, remove the temp dir as before;
4. If it's valid, rename the temp dir to the valid image dir.
It also fixes an issue that it uses const_cast in mkdtemp, which is
undefined behavior because the returned const char* shall be read-only,
writing this memory could cause undefined behavior.
Partially resovles openbmc/bmcweb#60
Tested: Verify the image upload works well, and it takes much less time
on a gzip compressed tarball.
Change-Id: I0af81acbd948e9c54d5d168c9f72e8ebbf8daebe
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'image_verify.cpp')
0 files changed, 0 insertions, 0 deletions