[PATCH] Bail out if glfs_creat failed

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

 



Otherwise we will get segfaults from gfapi when it tries to access the
invalid fd.
---
 engines/glusterfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/engines/glusterfs.c b/engines/glusterfs.c
index 94daab5..a64c687 100644
--- a/engines/glusterfs.c
+++ b/engines/glusterfs.c
@@ -160,8 +160,9 @@ int fio_gf_open_file(struct thread_data *td, struct fio_file *f)
 	       flags & O_RDONLY ? "ro" : "rw", td_read(td) ? "read" : "write");
 	g->fd = glfs_creat(g->fs, f->file_name, flags, 0644);
 	if (!g->fd) {
-		log_err("glfs_creat failed.\n");
 		ret = errno;
+		log_err("glfs_creat failed.\n");
+		return ret;
 	}
 	/* file for read doesn't exist or shorter than required, create/extend it */
 	if (td_read(td)) {
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux