summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-25 10:44:09 +0200
committerDjalal Harouni <tixxdz@opendz.org>2016-09-25 10:19:10 +0200
commit6ee1a919cf9013a695da2a01ae67327b996a6ef6 (patch)
treed03b763f9c619fd83a72c6795133db43172f6855 /src
parent3fbe8dbe41ad662d7cae0525f6fd62a66d2c5ec5 (diff)
namespace: simplify mount_path_compare() a bit
Diffstat (limited to 'src')
-rw-r--r--src/core/namespace.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 102fe576f3..74201caa10 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) {