mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:25:56 +00:00
UI: Fix ConfBuffer::write() result's using
This commit is contained in:
parent
53bb7f48ad
commit
190bb5bcc0
@ -70,10 +70,10 @@ void setConf(Device &device)
|
|||||||
|
|
||||||
ConfBuffer confBuf;
|
ConfBuffer confBuf;
|
||||||
|
|
||||||
const int confIoSize = confBuf.write(conf, nullptr, envManager);
|
ASSERT_TRUE(confBuf.write(conf, nullptr, envManager));
|
||||||
ASSERT_NE(confIoSize, 0);
|
|
||||||
|
|
||||||
ASSERT_TRUE(device.ioctl(DriverCommon::ioctlSetConf(), confBuf.data(), confIoSize));
|
auto confData = confBuf.buffer();
|
||||||
|
ASSERT_TRUE(device.ioctl(DriverCommon::ioctlSetConf(), confData.data(), confData.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void printLogs(LogBuffer &buf)
|
void printLogs(LogBuffer &buf)
|
||||||
|
@ -69,10 +69,9 @@ TEST_F(ConfUtilTest, confWriteRead)
|
|||||||
|
|
||||||
ConfBuffer confBuf;
|
ConfBuffer confBuf;
|
||||||
|
|
||||||
const int confIoSize = confBuf.write(conf, nullptr, envManager);
|
if (!confBuf.write(conf, nullptr, envManager)) {
|
||||||
if (confIoSize == 0) {
|
|
||||||
qCritical() << "Error:" << confBuf.errorMessage();
|
qCritical() << "Error:" << confBuf.errorMessage();
|
||||||
ASSERT_NE(confIoSize, 0);
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the buffer
|
// Check the buffer
|
||||||
|
@ -903,8 +903,7 @@ bool ConfManager::validateConf(const FirewallConf &newConf)
|
|||||||
|
|
||||||
ConfBuffer confBuf;
|
ConfBuffer confBuf;
|
||||||
|
|
||||||
const int confSize = confBuf.write(newConf, IoC<ConfAppManager>(), *IoC<EnvManager>());
|
if (!confBuf.write(newConf, IoC<ConfAppManager>(), *IoC<EnvManager>())) {
|
||||||
if (confSize == 0) {
|
|
||||||
qCCritical(LC) << "Conf save error:" << confBuf.errorMessage();
|
qCCritical(LC) << "Conf save error:" << confBuf.errorMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user