Skip to content

Commit

Permalink
fix canifconfig error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
HubertD committed May 22, 2016
1 parent 237252e commit 5bb293b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/driver/SocketCanDriver/SocketCanInterface.cpp
Expand Up @@ -135,6 +135,9 @@ void SocketCanInterface::applyConfig(const MeasurementInterface &mi)
}

log_info(QString("calling canifconfig to reconfigure interface %1").arg(getName()));
QStringList sl = buildCanIfConfigArgs(mi);
sl.prepend("canifconfig");
log_info(sl.join(" "));

QProcess canIfConfig;
canIfConfig.start("canifconfig", buildCanIfConfigArgs(mi));
Expand All @@ -143,9 +146,13 @@ void SocketCanInterface::applyConfig(const MeasurementInterface &mi)
return;
}

if (canIfConfig.exitStatus() != 0) {
log_error(QString("canifconfig failed:"));
log_error(canIfConfig.readAllStandardError());
if (canIfConfig.exitStatus()!=QProcess::NormalExit) {
log_error(QString("canifconfig crashed"));
return;
}

if (canIfConfig.exitCode() != 0) {
log_error(QString("canifconfig failed: ") + QString(canIfConfig.readAllStandardError()).trimmed());
return;
}

Expand Down

0 comments on commit 5bb293b

Please sign in to comment.