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

Peter Krempa pkrempa at redhat.com
Thu Jul 10 14:22:42 UTC 2014


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




More information about the libvir-list mailing list