summaryrefslogtreecommitdiffstats
path: root/utils.hpp
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-03-08 16:41:51 +0800
committerLei YU <mine260309@gmail.com>2019-04-02 10:32:49 +0800
commit5d9302860ff4b064ae09bb91683cb7fa00ba7450 (patch)
treef20a0f3293ecdc13f61b1bf2e5a90f31b6658e7d /utils.hpp
parentab8231c66364286a10b0da6d64d9742752323b4d (diff)
downloadphosphor-bmc-code-mgmt-master.tar.gz
phosphor-bmc-code-mgmt-master.zip
Refactor: only untar onceHEADmaster
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 'utils.hpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud