[PATCH] virsh: check actual access to the cert

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

 



Instead of calling stat(), check that we'll actually be able to access
and read the file.

Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
 src/remote/remote_driver.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9965d38..c4e43aa 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -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, F_OK|R_OK)) {
         virReportSystemError(errno,
                              _("Cannot access %s '%s'"),
                              type, file);
-- 
1.7.5.rc3

--
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]