diff options
| author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2003-10-11 10:37:43 +0000 |
|---|---|---|
| committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2003-10-11 10:37:43 +0000 |
| commit | c0839c961f0bee99589694b05a65fe528f9c758e (patch) | |
| tree | 2cf28eee0a4ecb59d5806f9d7f60bf5892917974 | |
| parent | 84783ceaeb7086e7e3b8d412b40019e8009be601 (diff) | |
Notes
| -rw-r--r-- | sbin/ip6fw/ip6fw.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/ip6fw/ip6fw.c b/sbin/ip6fw/ip6fw.c index a76d03c6462bd..be9e17588226b 100644 --- a/sbin/ip6fw/ip6fw.c +++ b/sbin/ip6fw/ip6fw.c @@ -1,4 +1,4 @@ -/* $KAME: ip6fw.c,v 1.13 2001/06/22 05:51:16 itojun Exp $ */ +/* $KAME: ip6fw.c,v 1.14 2003/10/02 19:36:25 itojun Exp $ */ /* * Copyright (C) 1998, 1999, 2000 and 2001 WIDE Project. @@ -446,7 +446,7 @@ list(ac, av) int ac; char **av; { - struct ip6_fw *r, *rules; + struct ip6_fw *r, *rules, *n; int l,i; unsigned long rulenum; int nalloc, bytes, maxbytes; @@ -457,10 +457,10 @@ list(ac, av) bytes = nalloc; maxbytes = 65536 * sizeof *rules; while (bytes >= nalloc) { - nalloc = nalloc * 2 + 200; - bytes = nalloc; - if ((rules = realloc(rules, bytes)) == NULL) + if ((n = realloc(rules, nalloc * 2 + 200)) == NULL) err(EX_OSERR, "realloc"); + bytes = nalloc = nalloc * 2 + 200; + rules = n; i = getsockopt(s, IPPROTO_IPV6, IPV6_FW_GET, rules, &bytes); if ((i < 0 && errno != EINVAL) || nalloc > maxbytes) err(EX_OSERR, "getsockopt(IPV6_FW_GET)"); |
