Changeset 3060 in MondoRescue for branches/3.0/mondo/src/common/libmondo-stream.c
- Timestamp:
- Nov 10, 2012, 5:05:37 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-stream.c
r2900 r3060 116 116 char *blk; 117 117 int i; 118 int j; 118 119 119 120 blk = (char *) malloc(256 * 1024); … … 131 132 } 132 133 for (i = 0; i < 8 && !feof(g_tape_stream); i++) { 133 (void) fread(blk, 1, 256 * 1024, g_tape_stream); 134 j = fread(blk, 1, 256 * 1024, g_tape_stream); 135 if (j) { 136 // FIXME 137 } 134 138 } 135 139 sleep(1); … … 191 195 } 192 196 for (i = 0; i < 4 * 8; i++) { 193 (void) fwrite(blk, 1, 256 * 1024, g_tape_stream); 197 if (fwrite(blk, 1, 256 * 1024, g_tape_stream)) { 198 //FIXME 199 } 194 200 if (should_we_write_to_next_tape 195 201 (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) { … … 528 534 { 529 535 long long final_alleged_writeK, final_projected_certain_writeK, 530 final_actually_certain_writeK = 0,cposK, bufsize_K;536 cposK, bufsize_K; 531 537 int last, curr, i; 532 t_archtype type = other;533 538 char *command = NULL; 534 539 char *tmpdir = NULL; … … 542 547 } else { 543 548 suffix[0] = '\0'; 544 }545 if (strstr(latest_fname, ".afio.") || strstr(latest_fname, ".star.")) {546 type = fileset;547 } else if (strstr(latest_fname, "slice")) {548 type = biggieslice;549 } else {550 log_it("fname = %s", latest_fname);551 fatal_error552 ("Unknown type. Internal error in maintain_collection_of_recent_archives()");553 549 } 554 550 mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td); … … 572 568 cposK = g_tapecatalog->el[curr].tape_posK; 573 569 if (cposK < final_projected_certain_writeK) { 574 final_actually_certain_writeK = cposK;575 570 break; 576 571 } … … 845 840 g_tape_stream); 846 841 } 847 (void) fwrite(datablock, 1, (size_t) length, fout); 842 if (fwrite(datablock, 1, (size_t) length, fout)) { 843 // FIXME 844 } 848 845 g_tape_posK += length / 1024; 849 846 } … … 870 867 close_evalcall_form(); 871 868 log_it("Saved all.tar.gz to '%s'", outfname); 872 (void) getcwd(old_cwd, MAX_STR_LEN); 873 chdir(bkpinfo->tmpdir); 869 if (getcwd(old_cwd, MAX_STR_LEN)) { 870 // FIXME 871 } 872 if (chdir(bkpinfo->tmpdir)) { 873 // FIXME 874 } 874 875 mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", 875 876 outfname); … … 878 879 879 880 paranoid_system("cp -f tmp/mondo-restore.cfg . 2> /dev/null"); 880 chdir(old_cwd); 881 if (chdir(old_cwd)) { 882 // FIXME 883 } 881 884 unlink(outfname); 882 885 mr_free(outfname); … … 1059 1062 unsigned int crctt; 1060 1063 1061 bool had_to_resync = FALSE;1062 1063 1064 /*@ init ******************************************************* */ 1064 1065 malloc_string(temp_fname); … … 1072 1073 1073 1074 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1075 if (res) { 1076 // FIXME 1077 } 1074 1078 if (orig_size != temp_size && orig_size != -1) { 1075 1079 mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10); … … 1112 1116 for (size = orig_size; size > where_I_was_before_tape_change; 1113 1117 size -= bytes_to_write) { 1114 bytes_read = 1115 fread(datablock, 1, bytes_to_read, g_tape_stream); 1118 bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream); 1116 1119 } 1117 1120 log_msg(4, "'size' is now %lld (should be %lld)", size, 1118 1121 where_I_was_before_tape_change); 1119 1122 log_to_screen("Successfully re-sync'd tape"); 1120 had_to_resync = TRUE;1121 1123 bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream); 1122 1124 } 1123 1125 1124 (void) fwrite(datablock, 1, (size_t) bytes_to_write, fout); // for blocking reasons, bytes_successfully_read_in isn't necessarily the same as bytes_to_write 1126 if (fwrite(datablock, 1, (size_t) bytes_to_write, fout)) { // for blocking reasons, bytes_successfully_read_in isn't necessarily the same as bytes_to_write 1127 // FIXME 1128 } 1125 1129 1126 1130 #ifdef EXTRA_TAPE_CHECKSUMS … … 1197 1201 } 1198 1202 while (!(*pcontrol_char = tempblock[7000])) { 1199 g_tape_posK += 1200 fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, 1201 g_tape_stream) / 1024; 1203 g_tape_posK += fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream) / 1024; 1202 1204 } 1203 1205 /* memcpy((char*)plength_of_incoming_file,(char*)tempblock+7001,sizeof(long long)); */ … … 1347 1349 ctrl_chr = -1; 1348 1350 while (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1349 res = 1350 read_header_block_from_stream(&temp_size, temp_fname, 1351 &ctrl_chr); 1351 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1352 if (res) { 1353 // FIXME 1354 } 1352 1355 if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) { 1353 1356 break; … … 1358 1361 } 1359 1362 while (ctrl_chr != BLK_START_FILE) { 1360 res = 1361 read_header_block_from_stream(&temp_size, temp_fname, 1362 &ctrl_chr); 1363 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1363 1364 if (ctrl_chr == BLK_START_FILE) { 1364 1365 break; … … 1386 1387 bytes_to_write = 1387 1388 (size < TAPE_BLOCK_SIZE) ? (long) size : TAPE_BLOCK_SIZE; 1388 // FIXME - needs error-checking and -catching 1389 fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream); 1390 } 1391 res = 1392 read_header_block_from_stream(&temp_size, temp_fname, 1393 &ctrl_chr); 1389 if (fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream)) { 1390 // FIXME - needs error-checking and -catching 1391 } 1392 } 1393 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1394 1394 if (ctrl_chr != BLK_STOP_FILE) { 1395 1395 wrong_marker(BLK_STOP_FILE, ctrl_chr); 1396 1396 } 1397 res = 1398 read_header_block_from_stream(&temp_size, temp_fname, 1399 &ctrl_chr); 1397 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1400 1398 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) { 1401 1399 wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr); 1402 1400 } 1403 res = 1404 read_header_block_from_stream(&temp_size, temp_fname, 1405 &ctrl_chr); 1401 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1406 1402 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1407 1403 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 1408 1404 } 1409 res = 1410 read_header_block_from_stream(&temp_size, temp_fname, 1411 &ctrl_chr); 1405 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1412 1406 if (ctrl_chr != BLK_START_FILE) { 1413 1407 wrong_marker(BLK_START_FILE, ctrl_chr); … … 1493 1487 1494 1488 paranoid_pclose(g_tape_stream); 1495 system("sync");1496 system("sync");1497 system("sync");1489 paranoid_system("sync"); 1490 paranoid_system("sync"); 1491 paranoid_system("sync"); 1498 1492 log_it("New tape requested."); 1499 1493 insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too … … 1730 1724 bytes_to_read = TAPE_BLOCK_SIZE; 1731 1725 } 1732 (void) fread(datablock, 1, (size_t) bytes_to_read, fin); 1726 if (fread(datablock, 1, (size_t) bytes_to_read, fin)) { 1727 // FIXME 1728 } 1733 1729 g_tape_posK += 1734 1730 fwrite(datablock, 1, /*bytes_to_read */
Note:
See TracChangeset
for help on using the changeset viewer.