mirror of https://github.com/BOINC/boinc.git
client: fix error returns for get_mac_address() on Unix
This commit is contained in:
parent
3bfcef250e
commit
e3646cb406
|
@ -209,7 +209,7 @@ int get_mac_address(char* address) {
|
|||
sck = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sck < 0) {
|
||||
perror("socket");
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
/* Query available interfaces. */
|
||||
#ifdef HAVE_STRUCT_LIFCONF
|
||||
|
@ -218,7 +218,7 @@ int get_mac_address(char* address) {
|
|||
if (ioctl(sck, SIOCGLIFCONF, &ifc) < 0) {
|
||||
perror("ioctl(SIOCGLIFCONF)");
|
||||
close(sck);
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
ifc.ifc_len = sizeof(buf);
|
||||
|
@ -226,7 +226,7 @@ int get_mac_address(char* address) {
|
|||
if (ioctl(sck, SIOCGIFCONF, &ifc) < 0) {
|
||||
perror("ioctl(SIOCGIFCONF)");
|
||||
close(sck);
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -252,14 +252,14 @@ int get_mac_address(char* address) {
|
|||
if(ioctl(sck, SIOCGIFHWADDR, item) < 0) {
|
||||
perror("ioctl(SIOCGIFHWADDR)");
|
||||
close(sck);
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
hw_addr=(struct ether_addr *)(item->ifr_hwaddr.sa_data);
|
||||
#elif defined(SIOCGIFARP)
|
||||
if(ioctl(sck, SIOCGIFARP, item) < 0) {
|
||||
perror("ioctl(SIOCGIFARP)");
|
||||
close(sck);
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
hw_addr=(struct ether_addr *)&(item->lifr_lifru.lifru_enaddr);
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2013 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef MAC_ADDRESS_H
|
||||
#define MAC_ADDRESS_H
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ function get_platform_icon_flags($l) {
|
|||
$x->mac = false;
|
||||
$x->linux = false;
|
||||
$x->android = false;
|
||||
$x->freebsd = false;
|
||||
$x->rasp_pi = false;
|
||||
$x->nvidia_gpu = false;
|
||||
$x->amd_gpu = false;
|
||||
$x->intel_gpu = false;
|
||||
|
@ -70,6 +72,10 @@ function get_platform_icon_flags($l) {
|
|||
if (strstr($p, "darwin")) $x->mac = true;
|
||||
if (strstr($p, "linux")) $x->linux = true;
|
||||
if (strstr($p, "android")) $x->android = true;
|
||||
if (strstr($p, "freebsd")) $x->freebsd = true;
|
||||
if (strstr($p, "arm-unknown-linux-gnueabihf")) $x->rasp_pi = true;
|
||||
if (strstr($p, "armv5")) $x->rasp_pi = true;
|
||||
if (strstr($p, "armv6")) $x->rasp_pi = true;
|
||||
if (strstr($pc, "ati")) $x->amd_gpu = true;
|
||||
if (strstr($pc, "cuda")) $x->nvidia_gpu = true;
|
||||
if (strstr($pc, "intel_gpu")) $x->intel_gpu = true;
|
||||
|
@ -94,6 +100,12 @@ function platform_icons($f) {
|
|||
if ($f->android) {
|
||||
$x .= "<img hspace=$hs height=$ht src=images/android.png title=\"Supports Android\">";
|
||||
}
|
||||
if ($f->freebsd) {
|
||||
$x .= "<img hspace=$hs height=$ht src=images/freebsd.png title=\"Supports FreeBSD\">";
|
||||
}
|
||||
if ($f->rasp_pi) {
|
||||
$x .= "<img hspace=$hs height=$ht src=images/raspberry-pi.jpg title=\"Supports Raspberry Pi\">";
|
||||
}
|
||||
if ($f->nvidia_gpu) {
|
||||
$x .= "<img hspace=$hs height=$ht src=images/nvidia.jpg title=\"Supports NVIDIA GPUs\">";
|
||||
}
|
||||
|
@ -137,6 +149,7 @@ function canonical_plan_class($pc) {
|
|||
// ...
|
||||
//
|
||||
function get_platforms($url) {
|
||||
if (strstr($url, "radioactive")) return null;
|
||||
$url .= 'get_project_config.php';
|
||||
$x = @file_get_contents($url);
|
||||
if (!$x) {
|
||||
|
@ -288,6 +301,7 @@ function get_platform_icons($url) {
|
|||
}
|
||||
|
||||
//$u = "http://www.worldcommunitygrid.org/";
|
||||
//$u = "http://asteroidsathome.net/boinc/";
|
||||
//$u = "http://setiathome.berkeley.edu/";
|
||||
//$u = "http://aqua.dwavesys.com/";
|
||||
//$u = "http://lhcathome2.cern.ch/test4theory";
|
||||
|
|
Loading…
Reference in New Issue