Message ID | 20170812120510.28750-15-phil@nwl.cc |
---|---|
State | Changes Requested, archived |
Delegated to: | stephen hemminger |
Headers | show |
On 8/12/17 6:04 AM, Phil Sutter wrote: > Signed-off-by: Phil Sutter <phil@nwl.cc> > --- > ip/ipvrf.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/ip/ipvrf.c b/ip/ipvrf.c > index 0094cf8557cd7..92e2db98ca7d7 100644 > --- a/ip/ipvrf.c > +++ b/ip/ipvrf.c > @@ -268,7 +268,7 @@ static int vrf_configure_cgroup(const char *path, int ifindex) > fprintf(stderr, > "Failed to open cgroup path: '%s'\n", > strerror(errno)); > - goto out; > + return rc; > } > > /* > @@ -290,13 +290,14 @@ static int vrf_configure_cgroup(const char *path, int ifindex) > if (bpf_prog_attach_fd(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE)) { > fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n", > strerror(errno)); > - goto out; > + goto out2; > } > > rc = 0; > +out2: > + close(prog_fd); > out: > close(cg_fd); > - close(prog_fd); > > return rc; > } > Acked-by: David Ahern <dsahern@gmail.com>
On Sat, 12 Aug 2017 14:04:33 +0200
Phil Sutter <phil@nwl.cc> wrote:
> Signed-off-by: Phil Sutter <phil@nwl.cc>
close of -1 is a harmless.
diff --git a/ip/ipvrf.c b/ip/ipvrf.c index 0094cf8557cd7..92e2db98ca7d7 100644 --- a/ip/ipvrf.c +++ b/ip/ipvrf.c @@ -268,7 +268,7 @@ static int vrf_configure_cgroup(const char *path, int ifindex) fprintf(stderr, "Failed to open cgroup path: '%s'\n", strerror(errno)); - goto out; + return rc; } /* @@ -290,13 +290,14 @@ static int vrf_configure_cgroup(const char *path, int ifindex) if (bpf_prog_attach_fd(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE)) { fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n", strerror(errno)); - goto out; + goto out2; } rc = 0; +out2: + close(prog_fd); out: close(cg_fd); - close(prog_fd); return rc; }
Signed-off-by: Phil Sutter <phil@nwl.cc> --- ip/ipvrf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)