From: Lennart Poettering Date: Thu, 25 Aug 2016 08:44:09 +0000 (+0200) Subject: namespace: simplify mount_path_compare() a bit X-Git-Tag: v232~181^2~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ee1a919cf9013a695da2a01ae67327b996a6ef6;p=thirdparty%2Fsystemd.git namespace: simplify mount_path_compare() a bit --- diff --git a/src/core/namespace.c b/src/core/namespace.c index 102fe576f37..74201caa106 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -93,21 +93,19 @@ static int mount_path_compare(const void *a, const void *b) { const BindMount *p = a, *q = b; int d; + /* If the paths are not equal, then order prefixes first */ d = path_compare(p->path, q->path); + if (d != 0) + return d; - if (d == 0) { - /* If the paths are equal, check the mode */ - if (p->mode < q->mode) - return -1; - - if (p->mode > q->mode) - return 1; + /* If the paths are equal, check the mode */ + if (p->mode < q->mode) + return -1; - return 0; - } + if (p->mode > q->mode) + return 1; - /* If the paths are not equal, then order prefixes first */ - return d; + return 0; } static void drop_duplicates(BindMount *m, unsigned *n) {