[PATCH 2/2] Fix: Check if interface exists before creating it.
sjur.brandeland at stericsson.com
sjur.brandeland at stericsson.com
Mon Feb 1 07:50:24 PST 2010
From: Sjur Brændeland <sjur.brandeland at stericsson.com>
---
drivers/stemodem/gprs-context.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index c178fb6..79e697b 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -187,9 +187,11 @@ static gboolean caif_if_create(const char *interface, unsigned int connid)
return FALSE;
}
- if (ioctl(s, SIOCCAIFNETNEW, &ifr) < 0) {
- ofono_debug("Failed to create IP interface for CAIF");
- return FALSE;
+ if (ioctl(s, SIOCGIFINDEX, &ifr) != 0) {
+ if (ioctl(s, SIOCCAIFNETNEW, &ifr) < 0) {
+ ofono_debug("Failed to create IP interface for CAIF");
+ return FALSE;
+ }
}
return TRUE;
--
1.6.3.3
More information about the ofono
mailing list