From: Lennart Poettering Date: Thu, 17 Jun 2021 09:05:43 +0000 (+0200) Subject: path-util: make path_compare() accept NULL X-Git-Tag: v250-rc1~976 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=105396778174a39bb04e9a78281ec7601e252d9f;p=thirdparty%2Fsystemd.git path-util: make path_compare() accept NULL --- diff --git a/src/basic/path-util.c b/src/basic/path-util.c index e5afb5f5f5e..4aebb6541ea 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -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.