Ignore:
Timestamp:
Nov 10, 2012, 5:05:37 AM (11 years ago)
Author:
Bruno Cornec
Message:

r5035@localhost: bruno | 2012-11-09 03:17:01 +0100

  • Fix a compilation error and most compilation warnings
File:
1 edited

Legend:

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

    r2900 r3060  
    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);
     
    191195    }
    192196    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        }
    194200        if (should_we_write_to_next_tape
    195201            (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) {
     
    528534{
    529535    long long final_alleged_writeK, final_projected_certain_writeK,
    530         final_actually_certain_writeK = 0, cposK, bufsize_K;
     536        cposK, bufsize_K;
    531537    int last, curr, i;
    532     t_archtype type = other;
    533538    char *command = NULL;
    534539    char *tmpdir = NULL;
     
    542547    } else {
    543548        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_error
    552             ("Unknown type. Internal error in maintain_collection_of_recent_archives()");
    553549    }
    554550    mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td);
     
    572568        cposK = g_tapecatalog->el[curr].tape_posK;
    573569        if (cposK < final_projected_certain_writeK) {
    574             final_actually_certain_writeK = cposK;
    575570            break;
    576571        }
     
    845840                          g_tape_stream);
    846841            }
    847             (void) fwrite(datablock, 1, (size_t) length, fout);
     842            if (fwrite(datablock, 1, (size_t) length, fout)) {
     843                // FIXME
     844            }
    848845            g_tape_posK += length / 1024;
    849846        }
     
    870867    close_evalcall_form();
    871868    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    }
    874875    mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null",
    875876            outfname);
     
    878879
    879880    paranoid_system("cp -f tmp/mondo-restore.cfg . 2> /dev/null");
    880     chdir(old_cwd);
     881    if (chdir(old_cwd)) {
     882        // FIXME
     883    }
    881884    unlink(outfname);
    882885    mr_free(outfname);
     
    10591062    unsigned int crctt;
    10601063
    1061     bool had_to_resync = FALSE;
    1062 
    10631064    /*@ init  ******************************************************* */
    10641065    malloc_string(temp_fname);
     
    10721073
    10731074    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
     1075    if (res) {
     1076        // FIXME
     1077    }
    10741078    if (orig_size != temp_size && orig_size != -1) {
    10751079        mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
     
    11121116            for (size = orig_size; size > where_I_was_before_tape_change;
    11131117                 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);
    11161119            }
    11171120            log_msg(4, "'size' is now %lld (should be %lld)", size,
    11181121                    where_I_was_before_tape_change);
    11191122            log_to_screen("Successfully re-sync'd tape");
    1120             had_to_resync = TRUE;
    11211123            bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream);
    11221124        }
    11231125
    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        }
    11251129
    11261130#ifdef EXTRA_TAPE_CHECKSUMS
     
    11971201    }
    11981202    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;
    12021204    }
    12031205/*  memcpy((char*)plength_of_incoming_file,(char*)tempblock+7001,sizeof(long long)); */
     
    13471349    ctrl_chr = -1;
    13481350    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        }
    13521355        if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
    13531356            break;
     
    13581361    }
    13591362    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);
    13631364        if (ctrl_chr == BLK_START_FILE) {
    13641365            break;
     
    13861387            bytes_to_write =
    13871388                (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);
    13941394        if (ctrl_chr != BLK_STOP_FILE) {
    13951395            wrong_marker(BLK_STOP_FILE, ctrl_chr);
    13961396        }
    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);
    14001398        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    14011399            wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
    14021400        }
    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);
    14061402        if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    14071403            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
    14081404        }
    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);
    14121406        if (ctrl_chr != BLK_START_FILE) {
    14131407            wrong_marker(BLK_START_FILE, ctrl_chr);
     
    14931487
    14941488    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");
    14981492    log_it("New tape requested.");
    14991493    insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too
     
    17301724            bytes_to_read = TAPE_BLOCK_SIZE;
    17311725        }
    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        }
    17331729        g_tape_posK +=
    17341730            fwrite(datablock, 1, /*bytes_to_read */
Note: See TracChangeset for help on using the changeset viewer.