]> xenbits.xensource.com Git - libvirt.git/commitdiff
security: DAC: Remove superfluous link resolution
authorPeter Krempa <pkrempa@redhat.com>
Thu, 10 Jul 2014 13:20:24 +0000 (15:20 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 Jul 2014 07:58:59 +0000 (09:58 +0200)
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

index 4d2a9d6ef626738f21a0c66122aa47c066632188..cdb2735badbb238bf0e5adca3146e10a2533ff7a 100644 (file)
@@ -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);
 }