Fix check data device before register the modem

To avoid the race condition that modem is registered before we retrieve
the data device property.
This commit is contained in:
Zhenhua Zhang 2010-05-06 14:28:13 +08:00 committed by Denis Kenzior
parent 4c483acbc6
commit 988750898e
1 changed files with 3 additions and 2 deletions

View File

@ -97,7 +97,7 @@ static void add_mbm(struct ofono_modem *modem,
struct udev_device *udev_device)
{
const char *desc, *devnode;
const char *device, *network;
const char *device, *data, *network;
int registered;
desc = udev_device_get_sysattr_value(udev_device, "device/interface");
@ -143,9 +143,10 @@ static void add_mbm(struct ofono_modem *modem,
}
device = ofono_modem_get_string(modem, MODEM_DEVICE);
data = ofono_modem_get_string(modem, DATA_DEVICE);
network = ofono_modem_get_string(modem, NETWORK_INTERFACE);
if (device != NULL && network != NULL) {
if (device != NULL && data != NULL && network != NULL) {
ofono_modem_set_integer(modem, "Registered", 1);
ofono_modem_register(modem);
}