From cc67a2955193aa367065b95ed1f0eeb192b3c890 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 16 Aug 2010 11:02:05 -0500 Subject: [PATCH] ussd: Be extra pedantic trying to Cancel If we initiated a Respond() transaction, but have not returned from the callback. Or if we already called Cancel and it hasn't returned yet. --- src/ussd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ussd.c b/src/ussd.c index a2d6cf3..825d560 100644 --- a/src/ussd.c +++ b/src/ussd.c @@ -554,6 +554,13 @@ static DBusMessage *ussd_cancel(DBusConnection *conn, DBusMessage *msg, if (ussd->state == USSD_STATE_IDLE) return __ofono_error_not_active(msg); + /* We have called Respond() but not returned from its callback yet */ + if (ussd->state == USSD_STATE_USER_ACTION && ussd->pending) + return __ofono_error_busy(msg); + + if (ussd->cancel) + return __ofono_error_busy(msg); + if (!ussd->driver->cancel) return __ofono_error_not_implemented(msg); -- 2.7.4