Close file before return.
Fix coverity issue: CID 1019579
Signed-off-by: Li Wang <[email protected]>
Reported-by: Xianxia Xiao <[email protected]>
---
src/rbd.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/rbd.cc b/src/rbd.cc
index 41cd243..9556fb8 100644
--- a/src/rbd.cc
+++ b/src/rbd.cc
@@ -1125,8 +1125,10 @@ static int do_export_diff(librbd::Image& image, const
char *fromsnapname,
::encode(endsize, bl);
r = bl.write_fd(fd);
- if (r < 0)
+ if (r < 0) {
+ close(fd);
return r;
+ }
}
ExportContext ec(&image, fd, info.size);
@@ -1139,8 +1141,6 @@ static int do_export_diff(librbd::Image& image, const
char *fromsnapname,
bufferlist bl;
::encode(tag, bl);
r = bl.write_fd(fd);
- if (r < 0)
- return r;
}
out:
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html