]> arthur.barton.de Git - bup.git/commitdiff
Fix a valid warning that some compilers warned
authorBrandon Low <lostlogic@lostlogicx.com>
Mon, 14 Feb 2011 23:51:16 +0000 (15:51 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 15 Feb 2011 03:00:26 +0000 (19:00 -0800)
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

index df104cfc66ba39022b29bbc683aab1d40b5003f5..594ff0f9420d8a5790e43d8a3c30a6f8a2eec933 100644 (file)
@@ -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 PyErr_SetFromErrno(PyExc_OSError);
                ofs = 0x80000000 | ofs64_count++;
            }
            *ofs_ptr++ = htonl((uint32_t)ofs);