Skip to content

Commit

Permalink
Check pkg_exec() return code
Browse files Browse the repository at this point in the history
  • Loading branch information
doktornotor authored Jan 30, 2017
1 parent f383279 commit d8381d4
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,18 @@ function squid_clamav_version() {
global $img;
// ClamAV status and version
$s = (is_service_running("clamd") ? $img['up'] : $img['down']);
pkg_exec("query '%v' clamav", $version, $err);
$rc = pkg_exec("query '%v' clamav", $version, $err);
$version = (($rc != 0) ? "N/A" : $version);
$s .= "  ClamAV {$version}";
$s .= "  ";
// C-ICAP status and version
$s .= (is_service_running("c-icap") ? $img['up'] : $img['down']);
pkg_exec("query '%v' c-icap", $version, $err);
$rc = pkg_exec("query '%v' c-icap", $version, $err);
$version = (($rc != 0) ? "N/A" : $version);
$s .= "  C-ICAP {$version}";
// SquidClamav version
pkg_exec("query '%v' squidclamav", $version, $err);
$rc = pkg_exec("query '%v' squidclamav", $version, $err);
$version = (($rc != 0) ? "N/A" : $version);
$s .= "+  SquidClamav {$version}";
return $s;
}
Expand Down Expand Up @@ -119,7 +122,8 @@ function squid_antivirus_statistics() {
<td width="75%">
<?php
$updown = (is_service_running("squid") ? $img['up'] : $img['down']);
pkg_exec("query '%v' squid", $version, $err);
$rc = pkg_exec("query '%v' squid", $version, $err);
$version = (($rc != 0) ? "N/A" : $version);
echo "{$updown}&nbsp;&nbsp;${version}";
?>
</td>
Expand Down

0 comments on commit d8381d4

Please sign in to comment.