diff options
Diffstat (limited to 'src/libsystemd-bus/bus-internal.c')
-rw-r--r-- | src/libsystemd-bus/bus-internal.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-internal.c b/src/libsystemd-bus/bus-internal.c index cac948e875..afff7bd7c1 100644 --- a/src/libsystemd-bus/bus-internal.c +++ b/src/libsystemd-bus/bus-internal.c @@ -61,6 +61,29 @@ bool object_path_is_valid(const char *p) { return true; } +char* object_path_startswith(const char *a, const char *b) { + const char *p; + + if (!object_path_is_valid(a) || + !object_path_is_valid(b)) + return NULL; + + if (streq(b, "/")) + return (char*) a + 1; + + p = startswith(a, b); + if (!p) + return NULL; + + if (*p == 0) + return (char*) p; + + if (*p == '/') + return (char*) p + 1; + + return NULL; +} + bool interface_name_is_valid(const char *p) { const char *q; bool dot, found_dot = false; |