summaryrefslogtreecommitdiffstats
path: root/gatchat/gatppp.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-05-22 06:43:03 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-05-24 12:10:22 -0500
commit832cc3317b3d2effb37057f370893772798189e0 (patch)
tree602067d4ea3e62467267ea5bb2283ee1b6c3e28b /gatchat/gatppp.c
parente8c7fc8a8adc7235bf20fe898f5bb14d0ab9b00f (diff)
downloadofono-832cc3317b3d2effb37057f370893772798189e0.tar.bz2
gatppp: Make ppp->fd handling a bit easier to grok
Diffstat (limited to 'gatchat/gatppp.c')
-rw-r--r--gatchat/gatppp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 8229b523..000d18a9 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -293,6 +293,12 @@ void ppp_ipcp_up_notify(GAtPPP *ppp, const char *local, const char *peer,
{
ppp->net = ppp_net_new(ppp, ppp->fd);
+ /*
+ * ppp_net_new took control over the fd, whatever happens is out of
+ * our hands now
+ */
+ ppp->fd = -1;
+
if (ppp->net == NULL) {
ppp->disconnect_reason = G_AT_PPP_REASON_NET_FAIL;
pppcp_signal_close(ppp->lcp);
@@ -317,7 +323,6 @@ void ppp_ipcp_down_notify(GAtPPP *ppp)
return;
ppp_net_free(ppp->net);
- ppp->fd = -1;
ppp->net = NULL;
}