From: Wei Zhou <w.zhou(a)leaseweb.com>
Make virStorageBackendVolOpenCheckMode return -2 instead of
-1 if volume file is missing.
https://bugzilla.redhat.com/show_bug.cgi?id=977706
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/storage/storage_backend.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index e2527c9..a24e452 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1084,7 +1084,7 @@ virStorageBackendForType(int type)
* Allows caller to silently ignore files with improper mode
*
* Returns -1 on error, -2 if file mode is unexpected or the
- * volume is a dangling symbolic link.
+ * volume is a dangling symbolic link or file is missing.
*/
int
virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags)
@@ -1094,10 +1094,10 @@ virStorageBackendVolOpenCheckMode(const char *path, unsigned int
flags)
char *base = last_component(path);
if (lstat(path, &sb) < 0) {
- virReportSystemError(errno,
- _("cannot stat file '%s'"),
- path);
- return -1;
+ char ebuf[1024];
+ VIR_WARN(_("cannot stat file '%s': %s"), path,
+ virStrerror(errno, ebuf, sizeof(ebuf)));
+ return -2;
}
if (S_ISFIFO(sb.st_mode)) {
--
1.8.1.5