socat: fix darwin build by adding missing feature check

This commit is contained in:
midchildan 2021-12-11 03:39:27 +09:00
parent 5030bcc563
commit f720cf68d0
No known key found for this signature in database
GPG key ID: D9A5748BACC6E3C2
2 changed files with 28 additions and 0 deletions

View file

@ -16,6 +16,13 @@ stdenv.mkDerivation rec {
sha256 = "sha256-ZpCp+ZkEV7UFCXonK78sv0zDVXYXb3ZkbjUksOkcF2M=";
};
patches = [
# This adds missing feature checks for TCP_INFO, a Linux feature
#
# Discussed in https://github.com/Homebrew/homebrew-core/pull/88595
./socat-fix-feature-check-tcpinfo.patch
];
postPatch = ''
patchShebangs test.sh
substituteInPlace test.sh \

View file

@ -0,0 +1,21 @@
diff --git a/filan.c b/filan.c
index 3465f7c..77c22a4 100644
--- a/filan.c
+++ b/filan.c
@@ -905,6 +905,7 @@ int tcpan(int fd, FILE *outfile) {
#if WITH_TCP
int tcpan2(int fd, FILE *outfile) {
+#ifdef TCP_INFO
struct tcp_info tcpinfo;
socklen_t tcpinfolen = sizeof(tcpinfo);
int result;
@@ -930,6 +931,8 @@ int tcpan2(int fd, FILE *outfile) {
// fprintf(outfile, "%s={%u}\t", "TCPI_", tcpinfo.tcpi_);
return 0;
+#endif
+ return -1;
}
#endif /* WITH_TCP */