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

1.4.2
Thomas Schmitt 7 years ago
parent 8d8d0b97a7
commit 1d15b0845f
  1. 12
      test/telltoc.c

@ -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 : ",

Loading…
Cancel
Save