mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
security: DAC: Remove superfluous link resolution
When restoring security labels in the dac driver the code would resolve the file path and use the resolved one to be chown-ed. The setting code doesn't do that. Remove the unnecessary code.
This commit is contained in:
parent
222860cd36
commit
9f28599d51
@ -264,27 +264,10 @@ virSecurityDACSetOwnership(const char *path, uid_t uid, gid_t gid)
|
|||||||
static int
|
static int
|
||||||
virSecurityDACRestoreSecurityFileLabel(const char *path)
|
virSecurityDACRestoreSecurityFileLabel(const char *path)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
|
||||||
int rc = -1;
|
|
||||||
char *newpath = NULL;
|
|
||||||
|
|
||||||
VIR_INFO("Restoring DAC user and group on '%s'", path);
|
VIR_INFO("Restoring DAC user and group on '%s'", path);
|
||||||
|
|
||||||
if (virFileResolveLink(path, &newpath) < 0) {
|
|
||||||
virReportSystemError(errno,
|
|
||||||
_("cannot resolve symlink %s"), path);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat(newpath, &buf) != 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
/* XXX record previous ownership */
|
/* XXX record previous ownership */
|
||||||
rc = virSecurityDACSetOwnership(newpath, 0, 0);
|
return virSecurityDACSetOwnership(path, 0, 0);
|
||||||
|
|
||||||
err:
|
|
||||||
VIR_FREE(newpath);
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user