message: read: eliminate unix-fd specialization

The structure of the unix-fd reading is the same as a basic type,
so we can leverage the existing basic type function for it rather
than having a specialization.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3c629c94d860feb1580ae3622097ed738b4c1cba
diff --git a/include/sdbusplus/message/read.hpp b/include/sdbusplus/message/read.hpp
index 5cf0928..ac11cf0 100644
--- a/include/sdbusplus/message/read.hpp
+++ b/include/sdbusplus/message/read.hpp
@@ -136,7 +136,8 @@
         // For this default implementation, we need to ensure that only
         // basic types are used.
         static_assert(std::is_fundamental_v<Td<T>> ||
-                          std::is_convertible_v<Td<T>, const char*>,
+                          std::is_convertible_v<Td<T>, const char*> ||
+                          std::is_convertible_v<Td<T>, details::unix_fd_type>,
                       "Non-basic types are not allowed.");
 
         constexpr auto dbusType = std::get<0>(types::type_id<T>());
@@ -167,23 +168,6 @@
 template <typename T>
 using read_single_t = read_single<types::details::type_id_downcast_t<T>>;
 
-/** @brief Specialization of read_single for details::unix_fd. */
-template <>
-struct read_single<details::unix_fd_type>
-{
-    template <typename T>
-    static void op(sdbusplus::SdBusInterface* intf, sd_bus_message* m, T&& s)
-    {
-        constexpr auto dbusType = std::get<0>(types::type_id<T>());
-        int r = intf->sd_bus_message_read_basic(m, dbusType, &s.fd);
-        if (r < 0)
-        {
-            throw exception::SdBusError(-r,
-                                        "sd_bus_message_read_basic unix_fd");
-        }
-    }
-};
-
 /** @brief Specialization of read_single for various string class types.
  *
  *  Supports std::strings, details::string_wrapper and