X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fnamespace.c;h=718da2384dc21adc294384d26941b7ec7d11713b;hb=4543768d13946e9193b367330cb32ded4d96058a;hp=8155065fe42c5073f7ced1786ef9cf2ef9086cbc;hpb=3164e3cbc50b8754c51f1fdeda7a7d6cedcc39b6;p=elogind.git diff --git a/src/core/namespace.c b/src/core/namespace.c index 8155065fe..718da2384 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -83,9 +83,11 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) { static int mount_path_compare(const void *a, const void *b) { const BindMount *p = a, *q = b; + int d; - if (path_equal(p->path, q->path)) { + d = path_compare(p->path, q->path); + if (!d) { /* If the paths are equal, check the mode */ if (p->mode < q->mode) return -1; @@ -97,13 +99,7 @@ static int mount_path_compare(const void *a, const void *b) { } /* If the paths are not equal, then order prefixes first */ - if (path_startswith(p->path, q->path)) - return 1; - - if (path_startswith(q->path, p->path)) - return -1; - - return 0; + return d; } static void drop_duplicates(BindMount *m, unsigned *n) { @@ -297,7 +293,7 @@ static int mount_kdbus(BindMount *m) { goto fail; } - r = mount(m->path, busnode, "bind", MS_BIND, NULL); + r = mount(m->path, busnode, NULL, MS_BIND, NULL); if (r < 0) { log_error_errno(errno, "bind mount of %s failed: %m", m->path); r = -errno; @@ -527,7 +523,7 @@ fail: if (n > 0) { for (m = mounts; m < mounts + n; ++m) if (m->done) - umount2(m->path, MNT_DETACH); + (void) umount2(m->path, MNT_DETACH); } return r;