diff options
| author | Kartik Naik <kartik@bugqore.com> | 2026-07-29 16:16:59 +0530 |
|---|---|---|
| committer | Kartik Naik <kartik@bugqore.com> | 2026-07-29 16:16:59 +0530 |
| commit | 77bf7f28ec393eae42719aea28b9191fa4c0d7cb (patch) | |
| tree | 6285417d1d05c0241aa6bc31433b74aeef1ed019 | |
| parent | 2cb6e4f5215cada460aca50346478725bf754231 (diff) | |
| download | portable-77bf7f28ec393eae42719aea28b9191fa4c0d7cb.tar.gz portable-77bf7f28ec393eae42719aea28b9191fa4c0d7cb.tar.bz2 portable-77bf7f28ec393eae42719aea28b9191fa4c0d7cb.zip | |
use errx instead of setting errno for unsupported minttl
| -rw-r--r-- | patches/netcat.c.patch | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/patches/netcat.c.patch b/patches/netcat.c.patch index 680f02b..216debc 100644 --- a/patches/netcat.c.patch +++ b/patches/netcat.c.patch | |||
| @@ -131,7 +131,7 @@ | |||
| 131 | } | 131 | } |
| 132 | if (Iflag) { | 132 | if (Iflag) { |
| 133 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, | 133 | if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, |
| 134 | @@ -1612,13 +1641,27 @@ set_common_sockopts(int s, int af) | 134 | @@ -1612,13 +1641,23 @@ set_common_sockopts(int s, int af) |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | if (minttl != -1) { | 137 | if (minttl != -1) { |
| @@ -140,10 +140,8 @@ | |||
| 140 | IP_MINTTL, &minttl, sizeof(minttl))) | 140 | IP_MINTTL, &minttl, sizeof(minttl))) |
| 141 | err(1, "set IP min TTL"); | 141 | err(1, "set IP min TTL"); |
| 142 | +#else | 142 | +#else |
| 143 | + if (af == AF_INET) { | 143 | + if (af == AF_INET) |
| 144 | + errno = ENOPROTOOPT; | 144 | + errx(1, "set IP min TTL not supported"); |
| 145 | + err(1, "set IP min TTL not supported"); | ||
| 146 | + } | ||
| 147 | +#endif | 145 | +#endif |
| 148 | 146 | ||
| 149 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, | 147 | - else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6, |
| @@ -152,15 +150,13 @@ | |||
| 152 | IPV6_MINHOPCOUNT, &minttl, sizeof(minttl))) | 150 | IPV6_MINHOPCOUNT, &minttl, sizeof(minttl))) |
| 153 | err(1, "set IPv6 min hop count"); | 151 | err(1, "set IPv6 min hop count"); |
| 154 | +#else | 152 | +#else |
| 155 | + if (af == AF_INET6) { | 153 | + if (af == AF_INET6) |
| 156 | + errno = ENOPROTOOPT; | 154 | + errx(1, "set IPv6 min hop count not supported"); |
| 157 | + err(1, "set IPv6 min hop count not supported"); | ||
| 158 | + } | ||
| 159 | +#endif | 155 | +#endif |
| 160 | } | 156 | } |
| 161 | } | 157 | } |
| 162 | 158 | ||
| 163 | @@ -1849,15 +1892,19 @@ help(void) | 159 | @@ -1849,15 +1888,19 @@ help(void) |
| 164 | \t-P proxyuser\tUsername for proxy authentication\n\ | 160 | \t-P proxyuser\tUsername for proxy authentication\n\ |
| 165 | \t-p port\t Specify local port for remote connects\n\ | 161 | \t-p port\t Specify local port for remote connects\n\ |
| 166 | \t-R CAfile CA bundle\n\ | 162 | \t-R CAfile CA bundle\n\ |
