Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 1 | #include "config.h" |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 2 | |
| 3 | #include "image_manager.hpp" |
| 4 | |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 5 | #include "version.hpp" |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 6 | #include "watch.hpp" |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 7 | |
| 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> |
| 10 | #include <sys/stat.h> |
| 11 | #include <sys/wait.h> |
| 12 | #include <unistd.h> |
| 13 | |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 14 | #include <elog-errors.hpp> |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 15 | #include <phosphor-logging/elog.hpp> |
| 16 | #include <phosphor-logging/log.hpp> |
Adriana Kobylak | 43699ca | 2018-10-17 14:56:29 -0500 | [diff] [blame] | 17 | #include <xyz/openbmc_project/Software/Image/error.hpp> |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 18 | |
Adriana Kobylak | 58aa750 | 2020-06-08 11:12:11 -0500 | [diff] [blame] | 19 | #include <algorithm> |
| 20 | #include <cstring> |
| 21 | #include <filesystem> |
| 22 | #include <string> |
| 23 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 24 | namespace phosphor |
| 25 | { |
| 26 | namespace software |
| 27 | { |
| 28 | namespace manager |
| 29 | { |
| 30 | |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 31 | using namespace phosphor::logging; |
Adriana Kobylak | 43699ca | 2018-10-17 14:56:29 -0500 | [diff] [blame] | 32 | using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error; |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 33 | namespace Software = phosphor::logging::xyz::openbmc_project::Software; |
Adriana Kobylak | 43699ca | 2018-10-17 14:56:29 -0500 | [diff] [blame] | 34 | using ManifestFail = Software::Image::ManifestFileFailure; |
| 35 | using UnTarFail = Software::Image::UnTarFailure; |
| 36 | using InternalFail = Software::Image::InternalFailure; |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 37 | using ImageFail = Software::Image::ImageFailure; |
Adriana Kobylak | c98d912 | 2020-05-05 10:36:01 -0500 | [diff] [blame] | 38 | namespace fs = std::filesystem; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 39 | |
| 40 | struct RemovablePath |
| 41 | { |
| 42 | fs::path path; |
| 43 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 44 | RemovablePath(const fs::path& path) : path(path) |
Adriana Kobylak | 58aa750 | 2020-06-08 11:12:11 -0500 | [diff] [blame] | 45 | {} |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 46 | ~RemovablePath() |
| 47 | { |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 48 | if (!path.empty()) |
Adriana Kobylak | 2b2cd9f | 2018-02-12 16:20:13 -0600 | [diff] [blame] | 49 | { |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 50 | std::error_code ec; |
| 51 | fs::remove_all(path, ec); |
Adriana Kobylak | 2b2cd9f | 2018-02-12 16:20:13 -0600 | [diff] [blame] | 52 | } |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 53 | } |
| 54 | }; |
| 55 | |
Lei YU | f6144e9 | 2019-10-18 17:13:49 +0800 | [diff] [blame] | 56 | namespace // anonymous |
| 57 | { |
| 58 | |
| 59 | std::vector<std::string> getSoftwareObjects(sdbusplus::bus::bus& bus) |
| 60 | { |
| 61 | std::vector<std::string> paths; |
| 62 | auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH, |
| 63 | MAPPER_INTERFACE, "GetSubTreePaths"); |
| 64 | method.append(SOFTWARE_OBJPATH); |
| 65 | method.append(0); // Depth 0 to search all |
| 66 | method.append(std::vector<std::string>({VERSION_BUSNAME})); |
| 67 | auto reply = bus.call(method); |
| 68 | reply.read(paths); |
| 69 | return paths; |
| 70 | } |
| 71 | |
| 72 | } // namespace |
| 73 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 74 | int Manager::processImage(const std::string& tarFilePath) |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 75 | { |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 76 | if (!fs::is_regular_file(tarFilePath)) |
| 77 | { |
| 78 | log<level::ERR>("Error tarball does not exist", |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 79 | entry("FILENAME=%s", tarFilePath.c_str())); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 80 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 81 | return -1; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 82 | } |
| 83 | RemovablePath tarPathRemove(tarFilePath); |
| 84 | fs::path tmpDirPath(std::string{IMG_UPLOAD_DIR}); |
| 85 | tmpDirPath /= "imageXXXXXX"; |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 86 | auto tmpDir = tmpDirPath.string(); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 87 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 88 | // Create a tmp dir to extract tarball. |
| 89 | if (!mkdtemp(tmpDir.data())) |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 90 | { |
Gunnar Mills | 601bbf0 | 2017-10-25 13:46:11 -0500 | [diff] [blame] | 91 | log<level::ERR>("Error occurred during mkdtemp", |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 92 | entry("ERRNO=%d", errno)); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 93 | report<InternalFailure>(InternalFail::FAIL("mkdtemp")); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 94 | return -1; |
| 95 | } |
| 96 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 97 | tmpDirPath = tmpDir; |
| 98 | RemovablePath tmpDirToRemove(tmpDirPath); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 99 | fs::path manifestPath = tmpDirPath; |
| 100 | manifestPath /= MANIFEST_FILE_NAME; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 101 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 102 | // Untar tarball into the tmp dir |
| 103 | auto rc = unTar(tarFilePath, tmpDirPath.string()); |
| 104 | if (rc < 0) |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 105 | { |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 106 | log<level::ERR>("Error occurred during untar"); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 107 | return -1; |
| 108 | } |
| 109 | |
| 110 | // Verify the manifest file |
| 111 | if (!fs::is_regular_file(manifestPath)) |
| 112 | { |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 113 | log<level::ERR>("Error No manifest file", |
| 114 | entry("FILENAME=%s", tarFilePath.c_str())); |
| 115 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 116 | return -1; |
| 117 | } |
| 118 | |
| 119 | // Get version |
| 120 | auto version = Version::getValue(manifestPath.string(), "version"); |
| 121 | if (version.empty()) |
| 122 | { |
| 123 | log<level::ERR>("Error unable to read version from manifest file"); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 124 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 125 | return -1; |
| 126 | } |
| 127 | |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 128 | // Get running machine name |
| 129 | std::string currMachine = Version::getBMCMachine(OS_RELEASE_FILE); |
| 130 | if (currMachine.empty()) |
| 131 | { |
| 132 | log<level::ERR>("Failed to read machine name from osRelease", |
| 133 | entry("FILENAME=%s", OS_RELEASE_FILE)); |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 134 | report<ImageFailure>(ImageFail::FAIL("Failed to read machine name"), |
| 135 | ImageFail::PATH("OS_RELEASE_FILE")); |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 136 | return -1; |
| 137 | } |
| 138 | |
| 139 | // Get machine name for image to be upgraded |
| 140 | std::string machineStr = |
| 141 | Version::getValue(manifestPath.string(), "MachineName"); |
| 142 | if (!machineStr.empty()) |
| 143 | { |
| 144 | if (machineStr != currMachine) |
| 145 | { |
| 146 | log<level::ERR>("BMC upgrade: Machine name doesn't match", |
| 147 | entry("CURR_MACHINE=%s", currMachine.c_str()), |
| 148 | entry("NEW_MACHINE=%s", machineStr.c_str())); |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 149 | report<ImageFailure>( |
| 150 | ImageFail::FAIL("Machine name does not match"), |
| 151 | ImageFail::PATH(manifestPath.string().c_str())); |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 152 | return -1; |
| 153 | } |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | log<level::WARNING>("No machine name in Manifest file"); |
Adriana Kobylak | 447d0da | 2021-03-15 13:40:52 -0500 | [diff] [blame] | 158 | report<ImageFailure>( |
| 159 | ImageFail::FAIL("MANIFEST is missing machine name"), |
| 160 | ImageFail::PATH(manifestPath.string().c_str())); |
Vijay Khemka | b7c062e | 2019-09-18 17:15:57 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 163 | // Get purpose |
| 164 | auto purposeString = Version::getValue(manifestPath.string(), "purpose"); |
| 165 | if (purposeString.empty()) |
| 166 | { |
| 167 | log<level::ERR>("Error unable to read purpose from manifest file"); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 168 | report<ManifestFileFailure>(ManifestFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 169 | return -1; |
| 170 | } |
| 171 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 172 | auto purpose = Version::VersionPurpose::Unknown; |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 173 | try |
| 174 | { |
Leonel Gonzalez | 9a8d14c | 2017-06-22 11:42:24 -0500 | [diff] [blame] | 175 | purpose = Version::convertVersionPurposeFromString(purposeString); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 176 | } |
| 177 | catch (const sdbusplus::exception::InvalidEnumString& e) |
| 178 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 179 | log<level::ERR>("Error: Failed to convert manifest purpose to enum." |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 180 | " Setting to Unknown."); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 181 | } |
| 182 | |
Chanh Nguyen | 1fd6ddd | 2021-01-06 11:09:09 +0700 | [diff] [blame] | 183 | // Get ExtendedVersion |
| 184 | std::string extendedVersion = |
| 185 | Version::getValue(manifestPath.string(), "ExtendedVersion"); |
| 186 | |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 187 | // Compute id |
| 188 | auto id = Version::getId(version); |
| 189 | |
| 190 | fs::path imageDirPath = std::string{IMG_UPLOAD_DIR}; |
| 191 | imageDirPath /= id; |
| 192 | |
Gunnar Mills | f576bca | 2017-05-18 13:40:39 -0500 | [diff] [blame] | 193 | if (fs::exists(imageDirPath)) |
| 194 | { |
| 195 | fs::remove_all(imageDirPath); |
| 196 | } |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 197 | |
Lei YU | 5d93028 | 2019-03-08 16:41:51 +0800 | [diff] [blame] | 198 | // Rename the temp dir to image dir |
| 199 | fs::rename(tmpDirPath, imageDirPath); |
| 200 | |
| 201 | // Clear the path, so it does not attemp to remove a non-existing path |
| 202 | tmpDirToRemove.path.clear(); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 203 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 204 | auto objPath = std::string{SOFTWARE_OBJPATH} + '/' + id; |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 205 | |
Lei YU | f6144e9 | 2019-10-18 17:13:49 +0800 | [diff] [blame] | 206 | // This service only manages the uploaded versions, and there could be |
| 207 | // active versions on D-Bus that is not managed by this service. |
| 208 | // So check D-Bus if there is an existing version. |
| 209 | auto allSoftwareObjs = getSoftwareObjects(bus); |
| 210 | auto it = |
| 211 | std::find(allSoftwareObjs.begin(), allSoftwareObjs.end(), objPath); |
| 212 | if (versions.find(id) == versions.end() && it == allSoftwareObjs.end()) |
Saqib Khan | d377ba1 | 2017-10-16 14:32:30 -0500 | [diff] [blame] | 213 | { |
Lei YU | f6144e9 | 2019-10-18 17:13:49 +0800 | [diff] [blame] | 214 | // Create Version object |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 215 | auto versionPtr = std::make_unique<Version>( |
Chanh Nguyen | 1fd6ddd | 2021-01-06 11:09:09 +0700 | [diff] [blame] | 216 | bus, objPath, version, purpose, extendedVersion, |
| 217 | imageDirPath.string(), |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 218 | std::bind(&Manager::erase, this, std::placeholders::_1)); |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 219 | versionPtr->deleteObject = |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 220 | std::make_unique<phosphor::software::manager::Delete>(bus, objPath, |
| 221 | *versionPtr); |
Saqib Khan | ee13e83 | 2017-10-23 12:53:11 -0500 | [diff] [blame] | 222 | versions.insert(std::make_pair(id, std::move(versionPtr))); |
Saqib Khan | d377ba1 | 2017-10-16 14:32:30 -0500 | [diff] [blame] | 223 | } |
| 224 | else |
| 225 | { |
| 226 | log<level::INFO>("Software Object with the same version already exists", |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 227 | entry("VERSION_ID=%s", id.c_str())); |
Adriana Kobylak | 13e0991 | 2020-08-31 13:55:10 -0500 | [diff] [blame] | 228 | fs::remove_all(imageDirPath); |
Saqib Khan | d377ba1 | 2017-10-16 14:32:30 -0500 | [diff] [blame] | 229 | } |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 230 | return 0; |
| 231 | } |
| 232 | |
Leonel Gonzalez | 50d559c | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 233 | void Manager::erase(std::string entryId) |
| 234 | { |
| 235 | auto it = versions.find(entryId); |
| 236 | if (it == versions.end()) |
| 237 | { |
| 238 | return; |
| 239 | } |
Eddie James | 6d87371 | 2017-09-01 11:29:07 -0500 | [diff] [blame] | 240 | |
| 241 | if (it->second->isFunctional()) |
| 242 | { |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 243 | log<level::ERR>(("Error: Version " + entryId + |
| 244 | " is currently running on the BMC." |
| 245 | " Unable to remove.") |
| 246 | .c_str()); |
Eddie James | 6d87371 | 2017-09-01 11:29:07 -0500 | [diff] [blame] | 247 | return; |
| 248 | } |
| 249 | |
Leonel Gonzalez | 50d559c | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 250 | // Delete image dir |
| 251 | fs::path imageDirPath = (*(it->second)).path(); |
| 252 | if (fs::exists(imageDirPath)) |
| 253 | { |
| 254 | fs::remove_all(imageDirPath); |
| 255 | } |
| 256 | this->versions.erase(entryId); |
| 257 | } |
| 258 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 259 | int Manager::unTar(const std::string& tarFilePath, |
| 260 | const std::string& extractDirPath) |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 261 | { |
| 262 | if (tarFilePath.empty()) |
| 263 | { |
| 264 | log<level::ERR>("Error TarFilePath is empty"); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 265 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 266 | return -1; |
| 267 | } |
| 268 | if (extractDirPath.empty()) |
| 269 | { |
| 270 | log<level::ERR>("Error ExtractDirPath is empty"); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 271 | report<UnTarFailure>(UnTarFail::PATH(extractDirPath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 272 | return -1; |
| 273 | } |
| 274 | |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 275 | log<level::INFO>("Untaring", entry("FILENAME=%s", tarFilePath.c_str()), |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 276 | entry("EXTRACTIONDIR=%s", extractDirPath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 277 | int status = 0; |
| 278 | pid_t pid = fork(); |
| 279 | |
| 280 | if (pid == 0) |
| 281 | { |
| 282 | // child process |
Adriana Kobylak | 2285fe0 | 2018-02-27 15:36:59 -0600 | [diff] [blame] | 283 | execl("/bin/tar", "tar", "-xf", tarFilePath.c_str(), "-C", |
| 284 | extractDirPath.c_str(), (char*)0); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 285 | // execl only returns on fail |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 286 | log<level::ERR>("Failed to execute untar file", |
| 287 | entry("FILENAME=%s", tarFilePath.c_str())); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 288 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 289 | return -1; |
| 290 | } |
| 291 | else if (pid > 0) |
| 292 | { |
| 293 | waitpid(pid, &status, 0); |
Adriana Kobylak | 596466b | 2018-02-13 14:48:53 -0600 | [diff] [blame] | 294 | if (WEXITSTATUS(status)) |
| 295 | { |
| 296 | log<level::ERR>("Failed to untar file", |
| 297 | entry("FILENAME=%s", tarFilePath.c_str())); |
| 298 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
| 299 | return -1; |
| 300 | } |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 301 | } |
| 302 | else |
| 303 | { |
| 304 | log<level::ERR>("fork() failed."); |
Gunnar Mills | b30cadd | 2017-10-06 16:07:32 -0500 | [diff] [blame] | 305 | report<UnTarFailure>(UnTarFail::PATH(tarFilePath.c_str())); |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 306 | return -1; |
| 307 | } |
| 308 | |
| 309 | return 0; |
| 310 | } |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 311 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 312 | } // namespace manager |
| 313 | } // namespace software |
Gunnar Mills | fa34e02 | 2018-09-04 10:05:45 -0500 | [diff] [blame] | 314 | } // namespace phosphor |