summaryrefslogtreecommitdiff
blob: 87a2f8f84a27132584ce3b36808cbb8a054f765d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
And it's a good idea not to ignore fwrite's return value I suppose.

Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
---
 lib/bup/_helpers.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c
index df104cf..18a91a9 100644
--- a/lib/bup/_helpers.c
+++ b/lib/bup/_helpers.c
@@ -472,7 +472,8 @@ static PyObject *write_idx(PyObject *self, PyObject *args)
 	    if (ofs > 0x7fffffff)
 	    {
 		uint64_t nofs = htonll(ofs);
-		fwrite(&nofs, 8, 1, f);
+		if (fwrite(&nofs, 8, 1, f) != 1)
+		    return NULL;
 		ofs = 0x80000000 | ofs64_count++;
 	    }
 	    *ofs_ptr++ = htonl((uint32_t)ofs);
-- 
1.7.1