From e0409eabe2bf9e758c30aadfa31c2a70489293af Mon Sep 17 00:00:00 2001
From: noryb009 <noryb009@hotmail.com>
Date: Mon, 6 Jan 2014 09:16:49 -0500
Subject: [PATCH] Fix Coverity CID 991761: double close
---
src/bin/chop.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/bin/chop.c b/src/bin/chop.c
index bcde16b..fb705a1 100644
a
|
b
|
chop_file(int fdin, char *fname, off_t fsize)
|
200 | 200 | if (beg >= end) { |
201 | 201 | // read in another block |
202 | 202 | got = read(fdin, Block, BLOCKSIZE); |
203 | | if (got <= 0) |
| 203 | if (got <= 0) { |
| 204 | // if open, close the last output file |
| 205 | if (open_next_file == false) |
| 206 | close(fdout); |
204 | 207 | break; |
| 208 | } |
205 | 209 | |
206 | 210 | beg = Block; |
207 | 211 | end = Block + got - 1; |
… |
… |
chop_file(int fdin, char *fname, off_t fsize)
|
239 | 243 | open_next_file = true; |
240 | 244 | } |
241 | 245 | } |
242 | | |
243 | | // close up the last output file |
244 | | close(fdout); |
245 | 246 | } |