diff options
author | xebd <xeb@mail.ru> | 2022-08-30 15:54:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 15:54:00 +0300 |
commit | 38d96b8e20608fb743d543fe3f08ad4b9d1dcd66 (patch) | |
tree | a2fdc4379fbb71bcf843570af2c1a798c0c441db | |
parent | 34de38532c85fb7b61412e6dae58794bd93977f5 (diff) | |
parent | d09bc715a39c5f78c213c73cf98b8ef24a84a1ab (diff) | |
download | accel-ppp-38d96b8e20608fb743d543fe3f08ad4b9d1dcd66.tar.gz accel-ppp-38d96b8e20608fb743d543fe3f08ad4b9d1dcd66.zip |
Merge pull request #58 from svlobanov/accel-cmd-macos
accel-cmd: add macos compatibility
-rw-r--r-- | accel-cmd/accel_cmd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/accel-cmd/accel_cmd.c b/accel-cmd/accel_cmd.c index 273a2dda..3de8624f 100644 --- a/accel-cmd/accel_cmd.c +++ b/accel-cmd/accel_cmd.c @@ -480,7 +480,7 @@ static int accel_connect(struct host_params *peer, bool numeric) for (ai = res; ai; ai = ai->ai_next) { fd = socket(ai->ai_family, - ai->ai_socktype | SOCK_CLOEXEC, + ai->ai_socktype, ai->ai_protocol); if (fd < 0) { fverbf(stderr, "%s,%i:" @@ -488,10 +488,18 @@ static int accel_connect(struct host_params *peer, bool numeric) " socket() failed: %s\n", __func__, __LINE__, ai->ai_family, - ai->ai_socktype | SOCK_CLOEXEC, + ai->ai_socktype, ai->ai_protocol, strerror(errno)); continue; } + int ret = fcntl(fd, F_SETFD, FD_CLOEXEC); + if (ret == -1) { + fverbf(stderr, "%s,%i:" + " fcntl() failed on setting FD_CLOEXEC: %s\n", + __func__, __LINE__, + strerror(errno)); + continue; + } if (connect(fd, ai->ai_addr, ai->ai_addrlen) < 0) { fverbf(stderr, "%s,%i: connect() failed: %s\n", __func__, __LINE__, strerror(errno)); |