Fixed segfault (#654)

This commit is contained in:
Uwe Seimet 2022-02-08 01:11:44 +01:00 committed by GitHub
parent c80e010196
commit 0a55680a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -72,6 +72,10 @@ bool SCSIBR::Init(const map<string, string>& params)
// TAP Driver Generation // TAP Driver Generation
tap = new CTapDriver(GetParam("interfaces")); tap = new CTapDriver(GetParam("interfaces"));
m_bTapEnable = tap->Init(); m_bTapEnable = tap->Init();
if (!m_bTapEnable){
LOGERROR("Unable to open the TAP interface");
return false;
}
// Generate MAC Address // Generate MAC Address
memset(mac_addr, 0x00, 6); memset(mac_addr, 0x00, 6);

View File

@ -698,7 +698,7 @@ bool Attach(const CommandContext& context, const PbDeviceDefinition& pb_device,
if (!device->Init(params)) { if (!device->Init(params)) {
delete device; delete device;
return ReturnStatus(context, false, "Initialization of " + device->GetType() + " device, ID " +to_string(id) + return ReturnStatus(context, false, "Initialization of " + PbDeviceType_Name(type) + " device, ID " +to_string(id) +
", unit " +to_string(unit) + " failed"); ", unit " +to_string(unit) + " failed");
} }