Commit graph

22 commits

Author SHA1 Message Date
Petr Štetiar
c5f2053dfc workaround possibly false positive uses of memory after it is freed
scan-build from clang-9 has reported following:

 libubox/list.h:83:22: warning: Use of memory after it is freed
        entry->next->prev = entry->prev;
                            ^~~~~~~~~~~

 ubusd_event.c:42:3: warning: Use of memory after it is freed
                ubusd_delete_event_source(ev);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Which might be a false positives, but in order to make the code pass the
static analyzer checks, rewrite the while loops on lists with the safe
list iterator.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-19 11:18:07 +01:00
Petr Štetiar
d2e026a33d iron out all extra compiler warnings
clang-9 on x86/64 has reported following warnings/errors:

 libubus-acl.c:123:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 libubus-io.c:108:18: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 libubus-io.c:395:56: error: comparison of integers of different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 libubus-req.c:441:4: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:119:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd_acl.c:152:5: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:348:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:352:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:357:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:362:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:367:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
 ubusd_acl.c:447:16: error: comparison of integers of different signs: 'int' and '__size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
 ubusd_acl.c:502:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:123:13: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:170:15: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:262:43: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd.c:287:30: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd_event.c:170:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
 ubusd_obj.c:71:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-16 23:39:16 +01:00
Felix Fietkau
47d75dd84a ubusd: add monitor support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-11-19 22:32:11 +01:00
John Crispin
3df5b18af2 hook acl into ubusd
Signed-off-by: John Crispin <blogic@openwrt.org>
2015-06-18 19:01:17 +02:00
Hans Dedecker
7798d56301 ubus: Fix issues reported by static code analysis tool Klocwork
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-04-20 15:43:19 +02:00
Zefir Kurtisi
4d1cdc5527 libubus: replace __init with __constructor
__init has a naming collision with C++ and prevents ubus_common.h
from being included. Instead, use __constructor as defined from
libubox.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
2014-09-17 13:29:24 +02:00
Felix Fietkau
0fccce4445 remove the "method" argument for object subscription
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-14 13:11:40 +01:00
Felix Fietkau
a69f062cbd ubus: add notification for subscribers present/gone
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-14 13:00:57 +01:00
Felix Fietkau
d366a6de83 watch add/remove -> subscribe/unsubscribe:
rename the ADD_WATCH/REMOVE_WATCH messages to SUBSCRIBE/UNSUBSCRIBE and change
the message format and libubus API in preparation for adding object notifications

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-13 19:35:38 +01:00
Felix Fietkau
c6f7054515 ubusd: add support for watching objects to get notified when they go away 2012-05-19 21:09:35 +02:00
Felix Fietkau
9f911f14bf ubusd: allow registration of anonymous objects with type 2012-05-19 16:21:22 +02:00
Felix Fietkau
42bc27ae38 add copyright/license information 2011-06-17 16:35:11 +02:00
Felix Fietkau
74eddc472d add support for a const void * key in avl 2011-04-13 20:13:42 +02:00
Felix Fietkau
df1af726e2 do not reverse method sorting order 2011-03-27 01:39:14 +01:00
Felix Fietkau
0611a9248c add notifications for registered/unregistered objects with path 2011-02-10 01:31:52 +01:00
Felix Fietkau
cb1feedb5e follow blob_get_int* -> blob_get_u* rename 2011-02-06 21:37:37 +01:00
Felix Fietkau
9a03063aee fix event handler list initialization 2011-02-06 01:53:58 +01:00
Felix Fietkau
f6a6b0d492 add functionality for registering anonymous objects as event listeners 2011-02-05 19:53:14 +01:00
Felix Fietkau
fa989780bd add some stub functionality for the ubus event switch 2011-02-05 01:29:52 +01:00
Felix Fietkau
d80ebf55af add functions for internal object allocation 2011-02-05 00:21:27 +01:00
Felix Fietkau
527d252333 remove path based invoke functions, add stub implementation for invoking method calls 2011-01-31 02:41:32 +01:00
Felix Fietkau
dbd4c2f121 Initial import 2011-01-30 14:16:09 +01:00