diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-07 06:07:57 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-10-07 06:07:57 +0800 |
commit | fad0753b3435c6ce13536188b74f08c76309a1be (patch) | |
tree | d8d5f1b21531ba55c1e3f985cf0348f89bffa58a | |
parent | d4eed5208fa9181517ce5e89f0db8c4636cbf288 (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.
-rw-r--r-- | openbsc/src/bsc_msc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c index a5734de51..f11669361 100644 --- a/openbsc/src/bsc_msc.c +++ b/openbsc/src/bsc_msc.c @@ -216,7 +216,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); } |