commit:     918d955fd2de1f594b83508f5ddd5271534e3591
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Jan  9 23:20:39 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jan  9 23:25:28 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=918d955f

checkpath: use lchown instead of chown

Checkpath should never follow symbolic links when changing ownership of a file.

This is for https://github.com/openrc/openrc/issues/195.

 src/rc/checkpath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c
index b1509940..8846761b 100644
--- a/src/rc/checkpath.c
+++ b/src/rc/checkpath.c
@@ -168,7 +168,7 @@ static int do_check(char *path, uid_t uid, gid_t gid, 
mode_t mode,
                        return -1;
                }
                einfo("%s: correcting owner", path);
-               if (chown(path, uid, gid)) {
+               if (lchown(path, uid, gid)) {
                        eerror("%s: chown: %s", applet, strerror(errno));
                        return -1;
                }

Reply via email to