From df63d26366b39ad8eb1c1ba5876b57b6a15208ed Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Thu, 29 Apr 2021 17:28:15 +0200 Subject: use C++17 constructor template argument deduction (CTAD) --- ssh-agent-filter.C | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C index c513804..639e55c 100644 --- a/ssh-agent-filter.C +++ b/ssh-agent-filter.C @@ -61,8 +61,6 @@ using std::pair; #include #include -using std::mutex; -using std::lock_guard; #include @@ -103,7 +101,7 @@ bool debug{false}; bool all_confirmed{false}; string saf_name; fs::path path; -mutex fd_fork_mutex; +std::mutex fd_fork_mutex; string md5_hex (string const & s) { @@ -141,7 +139,7 @@ int make_upstream_agent_conn () { throw invalid_argument("no $SSH_AUTH_SOCK"); { - lock_guard lock{fd_fork_mutex}; + std::lock_guard lock{fd_fork_mutex}; if ((sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1) throw system_error(errno, system_category(), "socket"); cloexec(sock); @@ -165,7 +163,7 @@ int make_listen_sock () { struct sockaddr_un addr; { - lock_guard lock{fd_fork_mutex}; + std::lock_guard lock{fd_fork_mutex}; if ((sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1) throw system_error(errno, system_category(), "socket"); cloexec(sock); @@ -310,7 +308,7 @@ bool confirm (string const & question) { sap = "ssh-askpass"; pid_t pid; { - lock_guard lock{fd_fork_mutex}; + std::lock_guard lock{fd_fork_mutex}; pid = fork(); } if (pid < 0) @@ -636,7 +634,7 @@ int main (int const argc, char const * const * const argv) { select(listen_sock + 1, &fds, nullptr, nullptr, nullptr); int client_sock; { - lock_guard lock{fd_fork_mutex}; + std::lock_guard lock{fd_fork_mutex}; if ((client_sock = accept(listen_sock, nullptr, nullptr)) == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) continue; -- cgit v1.2.3