From 83335513317c9ec34bcf700e5fd9a39e8ee0b0ee Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Aug 2017 12:11:52 +0200 Subject: [PATCH] system/SignalFD: use class UniqueFileDescriptor --- src/system/SignalFD.cxx | 7 ------- src/system/SignalFD.hxx | 16 +++++----------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/system/SignalFD.cxx b/src/system/SignalFD.cxx index 559c5a56b..33062a396 100644 --- a/src/system/SignalFD.cxx +++ b/src/system/SignalFD.cxx @@ -32,13 +32,6 @@ SignalFD::Create(const sigset_t &mask) FatalSystemError("signalfd() failed"); } -void -SignalFD::Close() -{ - if (fd.IsDefined()) - fd.Close(); -} - int SignalFD::Read() { diff --git a/src/system/SignalFD.hxx b/src/system/SignalFD.hxx index 8caa80dfe..bf3c40ed6 100644 --- a/src/system/SignalFD.hxx +++ b/src/system/SignalFD.hxx @@ -21,7 +21,7 @@ #define MPD_SIGNAL_FD_HXX #include "check.h" -#include "FileDescriptor.hxx" +#include "UniqueFileDescriptor.hxx" #include @@ -29,24 +29,18 @@ * A class that wraps signalfd(). */ class SignalFD { - FileDescriptor fd; + UniqueFileDescriptor fd; public: - SignalFD():fd(-1) {} - ~SignalFD() { - Close(); - } - - SignalFD(const SignalFD &other) = delete; - SignalFD &operator=(const SignalFD &other) = delete; - /** * Create the signalfd or update its mask. * * All errors are fatal. */ void Create(const sigset_t &mask); - void Close(); + void Close() { + fd.Close(); + } int Get() const { return fd.Get();