aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_msc.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-07 04:52:22 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-07 04:55:42 +0800
commit1168d13e0c9e2ba3c9bc9fa7cfe419d0a51455a4 (patch)
treeb05eddebe1fdc3131e1f915f704f4d22658903cd /openbsc/src/bsc_msc.c
parent588c423f12a67b924c0a89d4cc0fc003ff2d077e (diff)
msc: Only unregister the fd if the fd value is valid.
This makes sure that someone can call bsc_msc_lost multiple times even if there is no MSC connection. This makes sense as bsc_msc_lost is public and be called from client code.
Diffstat (limited to 'openbsc/src/bsc_msc.c')
-rw-r--r--openbsc/src/bsc_msc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c
index a78a1416d..ed7477953 100644
--- a/openbsc/src/bsc_msc.c
+++ b/openbsc/src/bsc_msc.c
@@ -217,7 +217,9 @@ void bsc_msc_lost(struct bsc_msc_connection *con)
{
write_queue_clear(&con->write_queue);
bsc_del_timer(&con->timeout_timer);
- bsc_unregister_fd(&con->write_queue.bfd);
+
+ if (con->write_queue.bfd.fd >= 0)
+ bsc_unregister_fd(&con->write_queue.bfd);
connection_loss(con);
}