Minor fixes in cellNetCtl and cellSysutil

Also fixed a couple minor bugs relating to cache.
This commit is contained in:
Raul Tambre 2015-08-05 09:33:45 +03:00
parent 48def8fa5b
commit 8fd52666b7
2 changed files with 21 additions and 2 deletions

View File

@ -100,6 +100,12 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
cellNetCtl.Error("cellNetCtlGetInfo(INFO_MTU): GetAdaptersAddresses buffer overflow.");
free(pAddresses);
pAddresses = (PIP_ADAPTER_ADDRESSES)malloc(bufLen);
if (pAddresses == nullptr)
{
cellNetCtl.Error("cellNetCtlGetInfo(INFO_MTU): Unable to allocate memory for pAddresses.");
return CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED;
}
}
ret = GetAdaptersAddresses(AF_INET, GAA_FLAG_INCLUDE_PREFIX, nullptr, pAddresses, &bufLen);
@ -182,6 +188,12 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
cellNetCtl.Error("cellNetCtlGetInfo(IP_ADDRESS): GetAdaptersAddresses buffer overflow.");
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO*)malloc(bufLen);
if (pAdapterInfo == nullptr)
{
cellNetCtl.Error("cellNetCtlGetInfo(IP_ADDRESS): Unable to allocate memory for pAddresses.");
return CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED;
}
}
ret = GetAdaptersInfo(pAdapterInfo, &bufLen);
@ -251,6 +263,12 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> info)
cellNetCtl.Error("cellNetCtlGetInfo(INFO_NETMASK): GetAdaptersAddresses buffer overflow.");
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO*)malloc(bufLen);
if (pAdapterInfo == nullptr)
{
cellNetCtl.Error("cellNetCtlGetInfo(INFO_NETMASK): Unable to allocate memory for pAddresses.");
return CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED;
}
}
ret = GetAdaptersInfo(pAdapterInfo, &bufLen);

View File

@ -206,7 +206,7 @@ s32 cellSysCacheClear(void)
{
cellSysutil.Todo("cellSysCacheClear()");
if (g_sysutil->cacheMounted.exchange(false))
if (!g_sysutil->cacheMounted)
{
return CELL_SYSCACHE_ERROR_NOTMOUNTED;
}
@ -214,7 +214,7 @@ s32 cellSysCacheClear(void)
std::string localPath;
Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath);
// TODO: Delete everything in the cache folder, except the README
// TODO: Write tests to figure out, what is deleted.
return CELL_SYSCACHE_RET_OK_CLEARED;
}
@ -229,6 +229,7 @@ s32 cellSysCacheMount(vm::ptr<CellSysCacheParam> param)
strncpy(param->getCachePath, ("/dev_hdd1/cache/" + std::string(id) + "/").c_str(), CELL_SYSCACHE_PATH_MAX);
param->getCachePath[CELL_SYSCACHE_PATH_MAX - 1] = '\0';
Emu.GetVFS().CreateDir(std::string(param->getCachePath));
g_sysutil->cacheMounted.exchange(true);
return CELL_SYSCACHE_RET_OK_RELAYED;
}