mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
util: switch create_dir() from chown() to lchown()
Use lchown(), the safer variant of chown() that does not follow symlinks, when changing the ownership of a created directory (logdir, dumpdir, ntsdumpdir, and the directory of bindcmdaddress) to the chrony user.
This commit is contained in:
2
util.c
2
util.c
@@ -1203,7 +1203,7 @@ create_dir(char *p, mode_t mode, uid_t uid, gid_t gid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set its owner */
|
/* Set its owner */
|
||||||
if (chown(p, uid, gid) < 0) {
|
if (lchown(p, uid, gid) < 0) {
|
||||||
LOG(LOGS_ERR, "Could not change ownership of %s : %s", p, strerror(errno));
|
LOG(LOGS_ERR, "Could not change ownership of %s : %s", p, strerror(errno));
|
||||||
/* Don't leave it there with incorrect ownership */
|
/* Don't leave it there with incorrect ownership */
|
||||||
rmdir(p);
|
rmdir(p);
|
||||||
|
|||||||
Reference in New Issue
Block a user