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 8e40849678
commit 88d9f38385

View File

@ -714,8 +714,16 @@ int telltoc_read_and_print(struct burn_drive *drive,
print_result:;
total_count += data_count;
if (encoding == 1) {
if (data_count > 0)
fwrite(buf, data_count, 1, raw_fp);
if (data_count > 0) {
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) {
if (encoding == 0) {
sprintf(line, "%8ds + %4d : ",