From 918d955fd2de1f594b83508f5ddd5271534e3591 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Tue, 9 Jan 2018 17:20:39 -0600 Subject: [PATCH] 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; }