Handling failure to write to disk file. Coverity CID 21786.

This commit is contained in:
Thomas Schmitt 2015-10-29 10:16:12 +00:00
parent 8d8d0b97a7
commit 1d15b0845f

View File

@ -714,8 +714,16 @@ int telltoc_read_and_print(struct burn_drive *drive,
print_result:; print_result:;
total_count += data_count; total_count += data_count;
if (encoding == 1) { if (encoding == 1) {
if (data_count > 0) if (data_count > 0) {
fwrite(buf, data_count, 1, raw_fp); ret = fwrite(buf, data_count, 1, raw_fp);
if (ret < 1) {
fprintf(stderr,
"FAILURE: writing to '%s' : %s\n",
raw_file, strerror(errno));
fclose(raw_fp);
return 1;
}
}
} else for (i = 0; i < data_count; i += 16) { } else for (i = 0; i < data_count; i += 16) {
if (encoding == 0) { if (encoding == 0) {
sprintf(line, "%8ds + %4d : ", sprintf(line, "%8ds + %4d : ",