]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote: check actual access to the cert
authorDoug Goldstein <cardoe@gentoo.org>
Fri, 6 May 2011 16:24:25 +0000 (11:24 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 6 May 2011 16:38:14 +0000 (10:38 -0600)
Instead of calling stat(), check that we'll actually be able to access
and read the file.

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
src/remote/remote_driver.c

index 4c3bdf347aa2d1440151601517f7451ab75388f3..97ee84a5e2f319ef9657ec34f15629e7198c93ca 100644 (file)
@@ -1140,8 +1140,7 @@ static gnutls_certificate_credentials_t x509_cred;
 static int
 check_cert_file(const char *type, const char *file)
 {
-    struct stat sb;
-    if (stat(file, &sb) < 0) {
+    if (access(file, R_OK)) {
         virReportSystemError(errno,
                              _("Cannot access %s '%s'"),
                              type, file);