summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2008-11-14 12:54:01 +0000
committerRoss Burton <ross@openedhand.com>2008-11-14 12:54:01 +0000
commit06c8cd5b80d49bbd1369e71236e35ced31b0894e (patch)
treeb5e5cc538c4e162745e9e62a6be21fa8a3a463d0
parentc5d21ccde6c97591f1e78bb419e12855f89461ec (diff)
downloadgupnp-06c8cd5b80d49bbd1369e71236e35ced31b0894e.tar.gz
2008-11-14 Ross Burton <ross@linux.intel.com>
* libgupnp/gupnp-context.c: Handle fscanf failing in get_default_host_ip (thanks Sven Neumann). git-svn-id: https://svn.o-hand.com/repos/gupnp/trunk/gupnp@1359 d8cb91d7-bff9-0310-92b9-80b65e4482b2
-rw-r--r--ChangeLog5
-rw-r--r--libgupnp/gupnp-context.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4eb0008..ab401ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-11-14 Ross Burton <ross@linux.intel.com>
+ * libgupnp/gupnp-context.c:
+ Handle fscanf failing in get_default_host_ip (thanks Sven Neumann).
+
+2008-11-14 Ross Burton <ross@linux.intel.com>
+
* libgupnp/gupnp-service-proxy.c:
Fix typos (thanks Sven Neumann)
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index 18ea06f..9ef5e69 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -189,8 +189,11 @@ get_default_host_ip (void)
fp = fopen ("/proc/net/route", "r");
/* Skip the header */
- fscanf (fp, "%*[^\n]\n");
-
+ if (fscanf (fp, "%*[^\n]\n") == EOF) {
+ fclose (fp);
+ return NULL;
+ }
+
while ((ret = fscanf (fp,
"%31s %lx %*x %*X %*d %*d %*d %*x %*d %*d %*d",
dev, &dest)) != EOF) {