]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: fix set-default with empty root (#4118)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 10 Sep 2016 11:07:51 +0000 (12:07 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Sat, 10 Sep 2016 11:07:51 +0000 (13:07 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1374371

When root was empty or equal to "/", chroot_symlinks_same was called with
root==NULL, and strjoina returned "", so the code thought both paths are equal
even if they were not. Fix that by always providing a non-null first argument
to strjoina.

src/shared/install.c

index 11770d887fc363c6a88fb5f09bebe61cccd25bb0..5f12fb447f8d1b2dbb883927dc30c8d5e7c0eee2 100644 (file)
@@ -403,6 +403,9 @@ static bool chroot_symlinks_same(const char *root, const char *wd, const char *a
         /* This will give incorrect results if the paths are relative and go outside
          * of the chroot. False negatives are possible. */
 
+        if (!root)
+                root = "/";
+
         a = strjoina(path_is_absolute(a) ? root : wd, "/", a);
         b = strjoina(path_is_absolute(b) ? root : wd, "/", b);
         return path_equal_or_files_same(a, b);