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.
This commit is contained in:
William Hubbs 2018-01-09 17:20:39 -06:00
parent 92cfa0e543
commit 918d955fd2

View File

@ -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;
}