chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
32694ef
)
tests: clarify test_path_startswith return value (#4508)
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Sun, 30 Oct 2016 14:21:29 +0000
(10:21 -0400)
committer
Sven Eden
<yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:56 +0000
(08:50 +0200)
A pendant for #4481.
src/basic/path-util.c
patch
|
blob
|
history
diff --git
a/src/basic/path-util.c
b/src/basic/path-util.c
index cdbb2d39815f349fd4736fcb05e639126935a312..3af95bf24e2365e74d59cc9b5a35fc220baf03a9 100644
(file)
--- a/
src/basic/path-util.c
+++ b/
src/basic/path-util.c
@@
-356,6
+356,16
@@
char* path_startswith(const char *path, const char *prefix) {
assert(path);
assert(prefix);
+ /* Returns a pointer to the start of the first component after the parts matched by
+ * the prefix, iff
+ * - both paths are absolute or both paths are relative,
+ * and
+ * - each component in prefix in turn matches a component in path at the same position.
+ * An empty string will be returned when the prefix and path are equivalent.
+ *
+ * Returns NULL otherwise.
+ */
+
if ((path[0] == '/') != (prefix[0] == '/'))
return NULL;