Check interval parameters and request first update
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 5 Jan 2010 15:13:34 +0000 (07:13 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 5 Jan 2010 15:13:34 +0000 (07:13 -0800)
src/counter.c

index 31d463e..7c213b6 100644 (file)
@@ -86,6 +86,9 @@ int __connman_counter_register(const char *owner, const char *path,
 
        DBG("owner %s path %s interval %u", owner, path, interval);
 
+       if (interval < 1)
+               return -EINVAL;
+
        counter = g_hash_table_lookup(counter_table, path);
        if (counter != NULL)
                return -EEXIST;
@@ -106,6 +109,8 @@ int __connman_counter_register(const char *owner, const char *path,
        counter->watch = g_dbus_add_disconnect_watch(connection, owner,
                                        owner_disconnect, counter, NULL);
 
+       __connman_rtnl_request_update();
+
        return 0;
 }