message: Use socket guard instead of calling close manually
diff: -#include "caf/config.hpp"
  +/******************************************************************************
  + * ____ _ _____ *
  + * / ___| / \ | ___| C++ *
  + * | | / _ \ | |_ Actor *
  + * | |___ / ___ \| _| Framework *
  + * \____/_/ \_|_| *
  + * *
  + * Copyright 2011-2018 Dominik Charousset *
  + * *
  + * Distributed under the terms and conditions of the BSD 3-Clause License or *
  + * (at your option) under the terms and conditions of the Boost Software *
  + * License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
  + * *
  + * If you did not receive a copy of the license files, see *
  + * http://opensource.org/licenses/BSD-3-Clause and *
  + * http://www.boost.org/LICENSE_1_0.txt. *
  + ******************************************************************************/
  +
  #include "caf/detail/get_mac_addresses.hpp"
  +#include "caf/config.hpp"
  +#include "caf/detail/socket_guard.hpp"
  +
  #if defined(CAF_MACOS) || defined(CAF_BSD) || defined(CAF_IOS)
  #include <sys/types.h>
  @@ -110,6 +130,7 @@ std::vector<iface_info> get_mac_addresses() {
  perror("socket");
  return {};
  }
  + socket_guard guard{sck};
  // query available interfaces
  char buf[1024] = {0};
  ifconf ifc;
  @@ -117,7 +138,6 @@ std::vector<iface_info> get_mac_addresses() {
  ifc.ifc_buf = buf;
  if (ioctl(sck, SIOCGIFCONF, &ifc) < 0) {
  perror("ioctl(SIOCGIFCONF)");
  - close(sck);
  return {};
  }
  std::vector<iface_info> result;
  @@ -132,7 +152,6 @@ std::vector<iface_info> get_mac_addresses() {
  // get mac address
  if (ioctl(sck, SIOCGIFHWADDR, item) < 0) {
  perror("ioctl(SIOCGIFHWADDR)");
  - close(sck);
  return {};
  }
  std::ostringstream oss;
  @@ -149,7 +168,6 @@ std::vector<iface_info> get_mac_addresses() {
  result.push_back({item->ifr_name, std::move(addr)});
  }
  }
  - close(sck);
  return result;
  }
  