diff options
author | David Michael <dm0@redhat.com> | 2019-02-25 13:26:07 -0500 |
---|---|---|
committer | David Michael <dm0@redhat.com> | 2019-02-28 13:06:07 -0500 |
commit | c3aa4adcafa046da7c41ef2e5411fc8dd8feecaa (patch) | |
tree | 0f75ee1c9a3705c149cb986b66a62df602f59490 /src/tmpfiles | |
parent | cc14a6c011604c3b598247c35fea78d11c8d15ab (diff) | |
download | systemd-c3aa4adcafa046da7c41ef2e5411fc8dd8feecaa.tar.gz systemd-c3aa4adcafa046da7c41ef2e5411fc8dd8feecaa.tar.bz2 systemd-c3aa4adcafa046da7c41ef2e5411fc8dd8feecaa.zip |
tmpfiles: pass arg_root to chase_symlinks as the root prefix
This informs chase_symlinks that symlinks should be treated as if
the path given by --root= is the root of their file system.
With the parent commit, this allows tmpfiles to create files as the
root user under a prefix that may be owned by an unprivileged user.
In particular, this fixes the case where tmpfiles generates initial
files in a staging root directory for packaging under a directory
owned by the unprivileged packager user (e.g. in Gentoo).
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 6296a8acdf..801e79b01d 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -856,7 +856,7 @@ static int path_open_parent_safe(const char *path) { if (!dn) return log_oom(); - fd = chase_symlinks(dn, NULL, CHASE_OPEN|CHASE_SAFE|CHASE_WARN, NULL); + fd = chase_symlinks(dn, arg_root, CHASE_OPEN|CHASE_SAFE|CHASE_WARN, NULL); if (fd < 0 && fd != -ENOLINK) return log_error_errno(fd, "Failed to validate path %s: %m", path); @@ -877,7 +877,7 @@ static int path_open_safe(const char *path) { "Failed to open invalid path '%s'.", path); - fd = chase_symlinks(path, NULL, CHASE_OPEN|CHASE_SAFE|CHASE_WARN|CHASE_NOFOLLOW, NULL); + fd = chase_symlinks(path, arg_root, CHASE_OPEN|CHASE_SAFE|CHASE_WARN|CHASE_NOFOLLOW, NULL); if (fd < 0 && fd != -ENOLINK) return log_error_errno(fd, "Failed to validate path %s: %m", path); @@ -2256,7 +2256,7 @@ static int process_item(Item *i, OperationMask operation) { i->done |= operation; - r = chase_symlinks(i->path, NULL, CHASE_NO_AUTOFS|CHASE_WARN, NULL); + r = chase_symlinks(i->path, arg_root, CHASE_NO_AUTOFS|CHASE_WARN, NULL); if (r == -EREMOTE) { log_notice_errno(r, "Skipping %s", i->path); return 0; |