dhcpcd-discuss

[PATCH] Fix up DBUS_TYPE_UINT32 handling

Nathan Williams

Thu Jun 24 20:28:11 2010

I noticed that only the first of the DNS servers advertised by my DHCP
server was being sent out over dbus. Here's a patch to fix it.
It should also fix the same problem for any of the other
array/uint32/ipv4-address types (all of the *_servers variables).

    - Nathan
From 7a8ef7ccd26aae84d9e8309e5fd6d74934a1e27c Mon Sep 17 00:00:00 2001
From: Nathan Williams <njw@xxxxxxxxxxxx>
Date: Thu, 24 Jun 2010 16:14:20 -0400
Subject: [PATCH] dbus-dict.c::append_config_array(): Fix up DBUS_TYPE_UINT32 handling
 to work for arrays of more than one element by parsing the current
 token rather than the entire string and avoiding fallthrough to the
 default case.

---
 dbus-dict.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dbus-dict.c b/dbus-dict.c
index 67bbdc3..922dbb6 100644
--- a/dbus-dict.c
+++ b/dbus-dict.c
@@ -164,13 +164,14 @@ append_config_array(DBusMessageIter *entry, int type, const char *data)
 			    DBUS_TYPE_STRING, &tok);
 			break;
 		case DBUS_TYPE_UINT32:
-			if (strchr(data, '.') != NULL &&
-			    inet_aton(data, &in) == 1)
+			if (strchr(tok, '.') != NULL &&
+			    inet_aton(tok, &in) == 1)
 				u32 = in.s_addr;
 			else
 				u32 = strtoul(tok, NULL, 0);
 			ok = dbus_message_iter_append_basic(&array,
 			    DBUS_TYPE_UINT32, &u32);
+                        break;
 		default:
 			ok = FALSE;
 			break;
-- 
1.7.0.1


Follow-Ups:
Re: [PATCH] Fix up DBUS_TYPE_UINT32 handlingRoy Marples
Archive administrator: postmaster@marples.name