Re: [libvirt] [PATCH 05/14] driver: fix handling of error return from finding resource

2018-04-24 Thread Michal Privoznik
On 04/19/2018 07:09 PM, Daniel P. Berrangé wrote:
> The virFileFindResource method merely builds up the expected fully
> qualified path to the resource. It does not actually check if it exists
> on disk. The loadable module callers were mistakenly thinking a NULL
> indicates the file doesn't exist on disk, whereas it in fact indicates
> an out of memory error.
> 
> Signed-off-by: Daniel P. Berrangé 
> ---
>  src/driver.c  | 2 +-
>  src/storage/storage_backend.c | 2 +-
>  src/util/virfile.c| 4 
>  3 files changed, 6 insertions(+), 2 deletions(-)

ACK

Michal

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

[libvirt] [PATCH 05/14] driver: fix handling of error return from finding resource

2018-04-19 Thread Daniel P . Berrangé
The virFileFindResource method merely builds up the expected fully
qualified path to the resource. It does not actually check if it exists
on disk. The loadable module callers were mistakenly thinking a NULL
indicates the file doesn't exist on disk, whereas it in fact indicates
an out of memory error.

Signed-off-by: Daniel P. Berrangé 
---
 src/driver.c  | 2 +-
 src/storage/storage_backend.c | 2 +-
 src/util/virfile.c| 4 
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/driver.c b/src/driver.c
index 4d314b3870..ddda1e71f7 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -153,7 +153,7 @@ virDriverLoadModule(const char *name,
 abs_topbuilddir "/src/.libs",
 DEFAULT_DRIVER_DIR,
 "LIBVIRT_DRIVER_DIR")))
-return 1;
+return -1;
 
 ret = virDriverLoadModuleFull(modfile, regfunc);
 
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index aac2f53b01..8c1dcf31b1 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -95,7 +95,7 @@ virStorageDriverLoadBackendModule(const char *name,
 abs_topbuilddir "/src/.libs",
 STORAGE_BACKEND_MODULE_DIR,
 "LIBVIRT_STORAGE_BACKEND_DIR")))
-return 1;
+return -1;
 
 if ((ret = virDriverLoadModuleFull(modfile, regfunc)) != 0) {
 if (forceload) {
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 5e9bd2007a..e12a584ca1 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -1736,6 +1736,10 @@ static bool useDirOverride;
  * run from the source tree. Otherwise it will return the
  * path in the installed location.
  *
+ * Note that this function does not actually check whether
+ * the file exists on disk, it merely builds the fully
+ * qualified path where it is supposed to exist.
+ *
  * If @envname is non-NULL it will override all other
  * directory lookup.
  *
-- 
2.14.3

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