|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging-4.14] tools/xenstore: simplify and rename check_event_node()
commit 4e298fa40781231ddc3f17e3e14e869c1c591722
Author: Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Thu Jun 11 16:12:40 2020 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 15 14:05:53 2020 +0100
tools/xenstore: simplify and rename check_event_node()
There is no path which allows to call check_event_node() without a
event name. So don't let the result depend on the name being NULL and
add an assert() covering that case.
Rename the function to check_special_event() to better match the
semantics.
This is part of XSA-115.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
Reviewed-by: Paul Durrant <paul@xxxxxxx>
---
tools/xenstore/xenstored_watch.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tools/xenstore/xenstored_watch.c b/tools/xenstore/xenstored_watch.c
index 7dedca60df..f2f1bed47c 100644
--- a/tools/xenstore/xenstored_watch.c
+++ b/tools/xenstore/xenstored_watch.c
@@ -47,13 +47,11 @@ struct watch
char *node;
};
-static bool check_event_node(const char *node)
+static bool check_special_event(const char *name)
{
- if (!node || !strstarts(node, "@")) {
- errno = EINVAL;
- return false;
- }
- return true;
+ assert(name);
+
+ return strstarts(name, "@");
}
/* Is child a subnode of parent, or equal? */
@@ -87,7 +85,7 @@ static void add_event(struct connection *conn,
unsigned int len;
char *data;
- if (!check_event_node(name)) {
+ if (!check_special_event(name)) {
/* Can this conn load node, or see that it doesn't exist? */
struct node *node = get_node(conn, ctx, name, XS_PERM_READ);
/*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |