Ignore:
Timestamp:
Jun 19, 2013, 8:34:46 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • First pass on svn merge -r 2935:3146 ../3.0
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/mondo/src/common/libmondo-stream.c

    r2937 r3147  
    116116    char *blk;
    117117    int i;
     118    int j;
    118119
    119120    blk = (char *) malloc(256 * 1024);
     
    131132    }
    132133    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        }
    134138    }
    135139    sleep(1);
     
    185189    }
    186190    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        }
    188194        if (should_we_write_to_next_tape
    189195            (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) {
     
    362368{
    363369    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 */
    365372    char *tmp = NULL;
    366373
     
    419426    res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    420427    log_msg(1, "End of extended attributes, now looking for afioball");
    421     return (0);
     428    return (res);
    422429}
    423430
     
    521528{
    522529    long long final_alleged_writeK, final_projected_certain_writeK,
    523         final_actually_certain_writeK = 0, cposK, bufsize_K;
     530        cposK, bufsize_K;
    524531    int last, curr, i;
    525     t_archtype type = other;
    526532    char *command = NULL;
    527533    char *tmpdir = NULL;
     
    557563        cposK = g_tapecatalog->el[curr].tape_posK;
    558564        if (cposK < final_projected_certain_writeK) {
    559             final_actually_certain_writeK = cposK;
    560565            break;
    561566        }
     
    835840                          g_tape_stream);
    836841            }
    837             (void) fwrite(datablock, 1, (size_t) length, fout);
     842            if (fwrite(datablock, 1, (size_t) length, fout)) {
     843                // FIXME
     844            }
    838845            g_tape_posK += length / 1024;
    839846        }
     
    860867    close_evalcall_form();
    861868    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    }
    864875    mr_asprintf(tmp, "tar -zxf %s ."MINDI_CACHE"/mondorestore.cfg 2> /dev/null", outfname);
    865876    paranoid_system(tmp);
     
    867878
    868879    paranoid_system("cp -f ."MINDI_CACHE"/mondorestore.cfg . 2> /dev/null");
    869     chdir(old_cwd);
     880    if (chdir(old_cwd)) {
     881        // FIXME
     882    }
    870883    unlink(outfname);
    871884    mr_free(outfname);
     
    10491062    unsigned int crctt;
    10501063
    1051     bool had_to_resync = FALSE;
    1052 
    10531064    /*@ init  ******************************************************* */
    10541065    malloc_string(temp_fname);
     
    10621073
    10631074    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
     1075    if (res) {
     1076        // FIXME
     1077    }
    10641078    if (orig_size != temp_size && orig_size != -1) {
    10651079        log_to_screen("output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
     
    11001114            for (size = orig_size; size > where_I_was_before_tape_change;
    11011115                 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);
    11041117            }
    11051118            log_msg(4, "'size' is now %lld (should be %lld)", size,
    11061119                    where_I_was_before_tape_change);
    11071120            log_to_screen("Successfully re-sync'd tape");
    1108             had_to_resync = TRUE;
    11091121            bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream);
    11101122        }
    11111123
    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        }
    11131127
    11141128#ifdef EXTRA_TAPE_CHECKSUMS
     
    11771191    }
    11781192    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;
    11821194    }
    11831195    memcpy((char *) plen, tempblock + 7001, sizeof(long long));
     
    13201332    ctrl_chr = -1;
    13211333    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);
    13241335        if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
    13251336            break;
     
    13301341    }
    13311342    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);
    13341344        if (ctrl_chr == BLK_START_FILE) {
    13351345            break;
     
    13561366            bytes_to_write =
    13571367                (size < TAPE_BLOCK_SIZE) ? (long) size : TAPE_BLOCK_SIZE;
    1358             // FIXME - needs error-checking and -catching
    1359             fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream);
    1360         }
    1361         res =
    1362             read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
     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);
    13631373        if (ctrl_chr != BLK_STOP_FILE) {
    13641374            wrong_marker(BLK_STOP_FILE, ctrl_chr);
    13651375        }
    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);
    13681377        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    13691378            wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
    13701379        }
    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);
    13731381        if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    13741382            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
    13751383        }
    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);
    13781385        if (ctrl_chr != BLK_START_FILE) {
    13791386            wrong_marker(BLK_START_FILE, ctrl_chr);
     
    16891696            bytes_to_read = TAPE_BLOCK_SIZE;
    16901697        }
    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        }
    16921701        g_tape_posK +=
    16931702            fwrite(datablock, 1, /*bytes_to_read */
Note: See TracChangeset for help on using the changeset viewer.