Commit b87badd9 authored by Aurelio Colosimo's avatar Aurelio Colosimo Committed by Alessandro Rubini

time-wrs/wrs-socket.c: fix init/exit funcs so that can called more than once

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent af50c9c4
......@@ -348,11 +348,16 @@ int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,
}
static int wrs_net_exit(struct pp_instance *ppi);
static int wrs_net_init(struct pp_instance *ppi)
{
int r, i;
hexp_port_state_t pstate;
if (NP(ppi)->ch[PP_NP_GEN].arch_data)
wrs_net_exit(ppi);
r = unix_net_ops.init(ppi);
if (r)
return r;
......@@ -419,6 +424,7 @@ static int wrs_net_exit(struct pp_instance *ppi)
{
unix_net_ops.exit(ppi);
free(NP(ppi)->ch[PP_NP_GEN].arch_data);
NP(ppi)->ch[PP_NP_GEN].arch_data = NULL;
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment