[PATCH 3/8] security: DAC: Remove superfluous link resolution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 src/security/security_dac.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 26cd615..6821d37 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -264,27 +264,10 @@ virSecurityDACSetOwnership(const char *path, uid_t uid, gid_t gid)
 static int
 virSecurityDACRestoreSecurityFileLabel(const char *path)
 {
-    struct stat buf;
-    int rc = -1;
-    char *newpath = NULL;
-
     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 */
-    rc = virSecurityDACSetOwnership(newpath, 0, 0);
-
- err:
-    VIR_FREE(newpath);
-    return rc;
+    return virSecurityDACSetOwnership(path, 0, 0);
 }


-- 
2.0.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]