From e3646cb406c352e95108b92fa8196505780ff4f0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 19 Nov 2013 11:23:38 -0800 Subject: [PATCH] client: fix error returns for get_mac_address() on Unix --- client/mac_address.cpp | 10 +++++----- client/mac_address.h | 17 +++++++++++++++++ doc/get_platforms.inc | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/client/mac_address.cpp b/client/mac_address.cpp index 3206bca365..f7e6b59b9c 100644 --- a/client/mac_address.cpp +++ b/client/mac_address.cpp @@ -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 diff --git a/client/mac_address.h b/client/mac_address.h index 538c10585e..ae9833d38e 100644 --- a/client/mac_address.h +++ b/client/mac_address.h @@ -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 . + #ifndef MAC_ADDRESS_H #define MAC_ADDRESS_H diff --git a/doc/get_platforms.inc b/doc/get_platforms.inc index f8265cfd38..0633c3b1ab 100644 --- a/doc/get_platforms.inc +++ b/doc/get_platforms.inc @@ -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 .= ""; } + if ($f->freebsd) { + $x .= ""; + } + if ($f->rasp_pi) { + $x .= ""; + } if ($f->nvidia_gpu) { $x .= ""; } @@ -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";