1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 23:21:22 +03:00

path-util: make path_compare() accept NULL

This commit is contained in:
Lennart Poettering 2021-06-17 11:05:43 +02:00
parent a520bb6654
commit 1053967781

View File

@ -466,8 +466,10 @@ char *path_startswith_full(const char *path, const char *prefix, bool accept_dot
int path_compare(const char *a, const char *b) {
int r;
assert(a);
assert(b);
/* Order NULL before non-NULL */
r = CMP(!!a, !!b);
if (r != 0)
return r;
/* A relative path and an absolute path must not compare as equal.
* Which one is sorted before the other does not really matter.