On 07-11-16 22:44, Gert Doering wrote: > The code was a mix of "assume that it is not NULL" and "check that > it is not NULL before using" - it cannot be NULL (due to the single > call graph, referencing c->sig with the global context), but for > good measure, add an ASSERT() upon function entry and get rid of > all the individual checks. > > Signed-off-by: Gert Doering <[email protected]> > --- > src/openvpn/socket.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c > index 184c7ad..18e6409 100644 > --- a/src/openvpn/socket.c > +++ b/src/openvpn/socket.c > @@ -1857,8 +1857,9 @@ link_socket_init_phase2 (struct link_socket *sock, > int sig_save = 0; > > ASSERT (sock); > + ASSERT (sig_info); > > - if (sig_info && sig_info->signal_received) > + if (sig_info->signal_received) > { > sig_save = sig_info->signal_received; > sig_info->signal_received = 0; > @@ -1879,7 +1880,7 @@ link_socket_init_phase2 (struct link_socket *sock, > if (sock->inetd) > { > phase2_inetd (sock, frame, remote_dynamic, > &sig_info->signal_received); > - if (sig_info && sig_info->signal_received) > + if (sig_info->signal_received) > goto done; > > } > @@ -1921,7 +1922,7 @@ link_socket_init_phase2 (struct link_socket *sock, > goto done; > } > > - if (sig_info && sig_info->signal_received) > + if (sig_info->signal_received) > goto done; > > if (sock->info.proto == PROTO_TCP_SERVER) > @@ -1942,7 +1943,7 @@ link_socket_init_phase2 (struct link_socket *sock, > if (sock->sd != -1) > protect_fd_nonlocal (sock->sd, &sock->info.lsa->actual.dest.addr.sa); > #endif > - if (sig_info && sig_info->signal_received) > + if (sig_info->signal_received) > goto done; > } > > @@ -1950,7 +1951,7 @@ link_socket_init_phase2 (struct link_socket *sock, > linksock_print_addr(sock); > > done: > - if (sig_save && sig_info) > + if (sig_save) > { > if (!sig_info->signal_received) > sig_info->signal_received = sig_save; >
ACK -Steffan ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
