dbus: check for signal uniqness

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-19 16:16:14 +02:00
parent 81d44ec5c4
commit 6dc68905dc
1 changed files with 6 additions and 1 deletions

5
dbus.c
View File

@ -651,6 +651,11 @@ luaA_dbus_add_signal(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
luaA_checkfunction(L, 2);
signal_t *sig = signal_array_getbyid(&dbus_signals,
a_strhash((const unsigned char *) name));
if(sig)
luaA_warn(L, "cannot add signal %s on D-Bus, already existing", name);
else
signal_add(&dbus_signals, name, luaA_object_ref(L, 2));
return 0;
}