aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2021-05-17 13:10:24 +0200
committerTimo Weingärtner <timo@tiwe.de>2026-03-07 22:25:16 +0100
commitadbbb81f7a82829363b41f6de8fc403caece3f33 (patch)
tree72e55eb22c8f7208d07a11016ccadc28105097a6
parent3088eda994ea0812e4aebf414334304723108671 (diff)
downloadssh-agent-filter-adbbb81f7a82829363b41f6de8fc403caece3f33.tar.gz
add SOCK_NONBLOCK on listen socket creation to possibly save a syscall
-rw-r--r--ssh-agent-filter.C5
1 files changed, 4 insertions, 1 deletions
diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C
index 61255a0..cadfd1d 100644
--- a/ssh-agent-filter.C
+++ b/ssh-agent-filter.C
@@ -88,6 +88,9 @@ using std::pair;
#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC 0
#endif
+#ifndef SOCK_NONBLOCK
+#define SOCK_NONBLOCK 0
+#endif
vector<string> allowed_b64;
vector<string> allowed_md5;
@@ -172,7 +175,7 @@ int make_upstream_agent_conn () {
}
int make_listen_sock () {
- int const sock = make_cloexec_socket(AF_UNIX, SOCK_STREAM, 0);
+ int const sock = make_cloexec_socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
alter_fd_flags<F_SETFL, O_NONBLOCK, 0>(sock);