comparison src/dumper.c @ 5839:d139eb1fead8

Check return value of fseek.
author Marcus Crestani <marcus@crestani.de>
date Sat, 13 Dec 2014 14:09:33 +0100
parents b1500f1ec617
children 93a18dbcfd8c
comparison
equal deleted inserted replaced
5838:b1500f1ec617 5839:d139eb1fead8
204 pdump_align_stream (FILE *stream, Bytecount alignment) 204 pdump_align_stream (FILE *stream, Bytecount alignment)
205 { 205 {
206 OFF_T offset = FTELL (stream); 206 OFF_T offset = FTELL (stream);
207 OFF_T adjustment = ALIGN_SIZE (offset, alignment) - offset; 207 OFF_T adjustment = ALIGN_SIZE (offset, alignment) - offset;
208 if (adjustment) 208 if (adjustment)
209 FSEEK (stream, adjustment, SEEK_CUR); 209 {
210 if (FSEEK (stream, adjustment, SEEK_CUR) == -1)
211 {
212 report_file_error ("Unable to fseek dump file",
213 build_ascstring (EMACS_PROGNAME ".dmp"));
214 }
215 }
210 } 216 }
211 217
212 #define PDUMP_ALIGN_OUTPUT(type) pdump_align_stream (pdump_out, ALIGNOF (type)) 218 #define PDUMP_ALIGN_OUTPUT(type) pdump_align_stream (pdump_out, ALIGNOF (type))
213 219
214 #define PDUMP_WRITE(type, object) \ 220 #define PDUMP_WRITE(type, object) \
2166 pdump_cv_ptr_info *elt = Dynarr_atp (pdump_cv_ptr, i); 2172 pdump_cv_ptr_info *elt = Dynarr_atp (pdump_cv_ptr, i);
2167 if(elt->fcts->convert_free) 2173 if(elt->fcts->convert_free)
2168 elt->fcts->convert_free(elt->object, elt->data, elt->size); 2174 elt->fcts->convert_free(elt->object, elt->data, elt->size);
2169 } 2175 }
2170 2176
2171 FSEEK (pdump_out, header.stab_offset, SEEK_SET); 2177 if (FSEEK (pdump_out, header.stab_offset, SEEK_SET) == -1)
2178 {
2179 report_file_error ("Unable to fseek dump file",
2180 build_ascstring (EMACS_PROGNAME ".dmp"));
2181 }
2172 2182
2173 #ifdef NEW_GC 2183 #ifdef NEW_GC
2174 { 2184 {
2175 EMACS_INT zero = 0; 2185 EMACS_INT zero = 0;
2176 pdump_scan_lisp_objects_by_alignment (pdump_dump_mc_data); 2186 pdump_scan_lisp_objects_by_alignment (pdump_dump_mc_data);