Changeset 3147 in MondoRescue for branches/3.1/mondo/src/common/libmondo-stream.c
- Timestamp:
- Jun 19, 2013, 8:34:46 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/common/libmondo-stream.c
r2937 r3147 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); … … 185 189 } 186 190 for (i = 0; i < 4 * 8; i++) { 187 (void) fwrite(blk, 1, 256 * 1024, g_tape_stream); 191 if (fwrite(blk, 1, 256 * 1024, g_tape_stream)) { 192 //FIXME 193 } 188 194 if (should_we_write_to_next_tape 189 195 (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) { … … 362 368 { 363 369 int res = 0; 364 char *fname = (char *)&res; /* Should NOT be NULL */ 370 char fname_buf[PATH_MAX]; 371 char *fname = (char *)fname_buf; /* Should NOT be NULL */ 365 372 char *tmp = NULL; 366 373 … … 419 426 res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr); 420 427 log_msg(1, "End of extended attributes, now looking for afioball"); 421 return ( 0);428 return (res); 422 429 } 423 430 … … 521 528 { 522 529 long long final_alleged_writeK, final_projected_certain_writeK, 523 final_actually_certain_writeK = 0,cposK, bufsize_K;530 cposK, bufsize_K; 524 531 int last, curr, i; 525 t_archtype type = other;526 532 char *command = NULL; 527 533 char *tmpdir = NULL; … … 557 563 cposK = g_tapecatalog->el[curr].tape_posK; 558 564 if (cposK < final_projected_certain_writeK) { 559 final_actually_certain_writeK = cposK;560 565 break; 561 566 } … … 835 840 g_tape_stream); 836 841 } 837 (void) fwrite(datablock, 1, (size_t) length, fout); 842 if (fwrite(datablock, 1, (size_t) length, fout)) { 843 // FIXME 844 } 838 845 g_tape_posK += length / 1024; 839 846 } … … 860 867 close_evalcall_form(); 861 868 log_it("Saved all.tar.gz to '%s'", outfname); 862 (void) getcwd(old_cwd, MAX_STR_LEN); 863 chdir(bkpinfo->tmpdir); 869 if (getcwd(old_cwd, MAX_STR_LEN)) { 870 // FIXME 871 } 872 if (chdir(bkpinfo->tmpdir)) { 873 // FIXME 874 } 864 875 mr_asprintf(tmp, "tar -zxf %s ."MINDI_CACHE"/mondorestore.cfg 2> /dev/null", outfname); 865 876 paranoid_system(tmp); … … 867 878 868 879 paranoid_system("cp -f ."MINDI_CACHE"/mondorestore.cfg . 2> /dev/null"); 869 chdir(old_cwd); 880 if (chdir(old_cwd)) { 881 // FIXME 882 } 870 883 unlink(outfname); 871 884 mr_free(outfname); … … 1049 1062 unsigned int crctt; 1050 1063 1051 bool had_to_resync = FALSE;1052 1053 1064 /*@ init ******************************************************* */ 1054 1065 malloc_string(temp_fname); … … 1062 1073 1063 1074 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1075 if (res) { 1076 // FIXME 1077 } 1064 1078 if (orig_size != temp_size && orig_size != -1) { 1065 1079 log_to_screen("output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10); … … 1100 1114 for (size = orig_size; size > where_I_was_before_tape_change; 1101 1115 size -= bytes_to_write) { 1102 bytes_read = 1103 fread(datablock, 1, bytes_to_read, g_tape_stream); 1116 bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream); 1104 1117 } 1105 1118 log_msg(4, "'size' is now %lld (should be %lld)", size, 1106 1119 where_I_was_before_tape_change); 1107 1120 log_to_screen("Successfully re-sync'd tape"); 1108 had_to_resync = TRUE;1109 1121 bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream); 1110 1122 } 1111 1123 1112 (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 1124 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 1125 // FIXME 1126 } 1113 1127 1114 1128 #ifdef EXTRA_TAPE_CHECKSUMS … … 1177 1191 } 1178 1192 while (!(*pcontrol_char = tempblock[7000])) { 1179 g_tape_posK += 1180 fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, 1181 g_tape_stream) / 1024; 1193 g_tape_posK += fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream) / 1024; 1182 1194 } 1183 1195 memcpy((char *) plen, tempblock + 7001, sizeof(long long)); … … 1320 1332 ctrl_chr = -1; 1321 1333 while (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1322 res = 1323 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1334 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1324 1335 if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) { 1325 1336 break; … … 1330 1341 } 1331 1342 while (ctrl_chr != BLK_START_FILE) { 1332 res = 1333 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1343 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1334 1344 if (ctrl_chr == BLK_START_FILE) { 1335 1345 break; … … 1356 1366 bytes_to_write = 1357 1367 (size < TAPE_BLOCK_SIZE) ? (long) size : TAPE_BLOCK_SIZE; 1358 // FIXME - needs error-checking and -catching1359 fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream);1360 }1361 res =1362 1368 if (fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream)) { 1369 // FIXME - needs error-checking and -catching 1370 } 1371 } 1372 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1363 1373 if (ctrl_chr != BLK_STOP_FILE) { 1364 1374 wrong_marker(BLK_STOP_FILE, ctrl_chr); 1365 1375 } 1366 res = 1367 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1376 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1368 1377 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) { 1369 1378 wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr); 1370 1379 } 1371 res = 1372 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1380 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1373 1381 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1374 1382 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 1375 1383 } 1376 res = 1377 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1384 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1378 1385 if (ctrl_chr != BLK_START_FILE) { 1379 1386 wrong_marker(BLK_START_FILE, ctrl_chr); … … 1689 1696 bytes_to_read = TAPE_BLOCK_SIZE; 1690 1697 } 1691 (void) fread(datablock, 1, (size_t) bytes_to_read, fin); 1698 if (fread(datablock, 1, (size_t) bytes_to_read, fin)) { 1699 // FIXME 1700 } 1692 1701 g_tape_posK += 1693 1702 fwrite(datablock, 1, /*bytes_to_read */
Note:
See TracChangeset
for help on using the changeset viewer.