X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=ston%2Fston_ht.h;fp=ston%2Fston_ht.h;h=4cddc78b15bec347e299b23d359df0e9f2de3856;hp=50634316aa88adf5ea8945d0c53d4f25eafe2395;hb=43d6067b655dbb51a4db074cfae58618b4ebb493;hpb=6f8c57f8040bf31ebad01119365b416a12c94341 diff --git a/ston/ston_ht.h b/ston/ston_ht.h index 5063431..4cddc78 100644 --- a/ston/ston_ht.h +++ b/ston/ston_ht.h @@ -195,8 +195,10 @@ size_t ston_ht32_fwrite { size_t bytes_written; long fpos_start; if ((fpos_start = ftell(file)) == NULL + || fseek(file, fpos, SEEK_SET) == 0 || (bytes_written = fwrite(file, 1, sizeof(ston_ht_h), file)) < sizeof(ston_ht_h) - || (bytes_written += fwrite(file, 1, ston_ht32_bytes(ht), file)) < (sizeof(ston_ht_h) + ston_ht32_bytes(ht))) + || (bytes_written += fwrite(file, 1, ston_ht32_bytes(ht), file)) < (sizeof(ston_ht_h) + ston_ht32_bytes(ht)) + || fseek(file, fpos_start, SEEK_SET) == 0) return 0; return bytes_written; }