Changeset 2332


Ignore:
Timestamp:
Aug 18, 2009, 3:33:19 PM (10 years ago)
Author:
bruno
Message:
 
Location:
branches/2.2.10
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2331 r2332  
    893893        flag_set['d'] = TRUE;
    894894        strcpy(flag_val['d'], p);
     895        mr_free(p);
    895896        log_to_screen("You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
    896897        percent = 0;
     
    15511552    case SIGKILL:
    15521553        mr_asprintf(tmp, "SIGKILL");
    1553         mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
     1554        mr_asprintf(tmp2,
     1555               "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
    15541556        break;
    15551557    case SIGTERM:
     
    15631565    case SIGSEGV:
    15641566        mr_asprintf(tmp, "SIGSEGV");
    1565         mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log.");
     1567        mr_asprintf(tmp2,
     1568               "Internal programming error. Please send a backtrace as well as your log.");
    15661569        break;
    15671570    case SIGPIPE:
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2331 r2332  
    14131413    char *tmp = NULL;
    14141414    char *p = NULL;
     1415    char *tmp1 = NULL;
    14151416    char *mds = NULL;
    14161417    char *sz_size = NULL;
  • branches/2.2.10/mondo/src/common/libmondo-fifo.c

    r2324 r2332  
    8888    for (bufsize = wise_upper_limit, res = -1;
    8989         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
    90         mr_asprintf(tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');
     90        mr_asprintf(tmp,"dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');
    9191        res = run_program_and_log_output(tmp, 2);
    9292        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2331 r2332  
    11031103    }
    11041104    *(p++) = '\0';
    1105     mr_asprintf(nfs_server_ipaddr, "%s", tmp);
    1106     mr_asprintf(nfs_mount, "%s", p);
     1105    mr_asprintf(nfs_server_ipaddr, tmp);
     1106    mr_asprintf(nfs_mount, p);
    11071107    mr_free(tmp);
    11081108
     
    11511151        mr_free(nfs_dev);
    11521152
    1153         mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1153        mr_asprintf(nfs_dev, call_program_and_get_last_line_of_output(command));
    11541154        mr_free(command);
    11551155
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2331 r2332  
    246246 * @return the allocated tape string if success, NULL if failure
    247247 */
    248 char *mr_find_tape_device(void)
    249 {
     248char *mr_find_tape_device(void) {
     249
    250250    char *tmp = NULL;
    251251    char *command = NULL;
     
    256256
    257257    log_to_screen("I am looking for your tape streamer. Please wait.");
     258
    258259    tmp = find_home_of_exe("cdrecord");
    259260    if (tmp) {
    260261        mr_asprintf(cdr_exe, "cdrecord");
     262
    261263    } else {
    262264        mr_asprintf(cdr_exe, "dvdrecord");
     
    270272    if (atoi(tmp) != 1) {
    271273        log_it("Either too few or too many tape streamers for me to detect...");
    272         mr_asprintf(&dev, "%s", VANILLA_SCSI_TAPE);
     274        mr_asprintf(dev, "%s", VANILLA_SCSI_TAPE);
    273275        mr_free(tmp);
    274276        mr_free(tmp);
     
    290292    mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);
    291293    mr_free(cdr_exe);
    292 
    293294    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    294295    mr_free(command);
     
    301302    if (!mt_says_tape_exists(dev)) {
    302303        mr_free(dev);
    303         mr_asprintf(&dev, "%s", ALT_TAPE);
     304        mr_asprintf(dev, "%s", ALT_TAPE);
    304305        if (!mt_says_tape_exists(dev)) {
    305306            log_it("Cannot openin %s", dev);
    306307            mr_free(dev);
    307             mr_asprintf(&dev, "/dev/st0");
     308            mr_asprintf(dev, "/dev/st0");
    308309            if (!mt_says_tape_exists(dev)) {
    309310                log_it("Cannot openin %s", dev);
    310311                mr_free(dev);
    311                 mr_asprintf(&dev, "/dev/osst0");
     312                mr_asprintf(dev, "/dev/osst0");
    312313                if (!mt_says_tape_exists(dev)) {
    313314                    mr_free(dev);
     
    335336        mr_asprintf(tmp, "%s", (strrchr(dev, '/') != NULL) ? strrchr(dev, '/') : dev);
    336337        mr_free(dev);
    337         mr_asprintf(&dev, "/dev/os%s", tmp);
     338        mr_asprintf(dev, "/dev/os%s", tmp);
    338339        log_it("...into %s", dev);
    339340        if (mt_says_tape_exists(dev)) {
     
    345346    }
    346347
    347     log_it("res=%d; dev=%s", res, dev);
    348 
    349348    if (dev) {
    350349        log_it("At this new point, dev = %s and res = %d", dev, res);
    351350    } else {
    352         log_it("At this new point, dev is NULL and res = %d", dev, res);
     351        log_it("At this new point, dev is NULL and res = %d", res);
    353352        mr_free(tmp);
    354         return(NULL);
    355353    }
    356354
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2331 r2332  
    956956            ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
    957957    }
    958     mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     958    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
    959959    if (atol(tmp) < 35000) {
    960960        retval++;
     
    11121112        log_to_screen("(read_cfg_var) Cannot find %s config file", config_file);
    11131113        return (NULL);
    1114         /* BERLIOS: not sure the sage of this one ?
     1114        /* BERLIOS: not sure the usage of this one ?
    11151115    } else if ((value != NULL) && (strstr(value, "/dev/") && strstr(value, "t0") && !strcmp(label, "media-dev"))) {
    11161116        log_msg(2, "FYI, I can't read new value for %s - already got %s", label, value);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2331 r2332  
    111111    }
    112112
    113     mr_asprintf(&command_ptr, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname_ptr);
     113    mr_asprintf(command_ptr, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname_ptr);
    114114    log_msg(2, command_ptr);
    115115    i =  system(command_ptr);
     
    207207                       noof_biggiefiles);
    208208    for (bigfileno = 0; bigfileno < noof_biggiefiles; bigfileno++) {
    209         mr_asprintf(&tmp, "Comparing big file #%ld", bigfileno + 1);
     209        mr_asprintf(tmp, "Comparing big file #%ld", bigfileno + 1);
    210210        log_msg(1, tmp);
    211211        update_progress_form(tmp);
     
    251251    char *tmp = NULL;
    252252    char *archiver_exe = NULL;
     253    char *tmp1 = NULL;
    253254    char *filelist_name = NULL;
    254255    char *logfile = NULL;
     
    257258    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
    258259    assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
    259     mr_asprintf(&filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);
     260    mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);
    260261    noof_lines = count_lines_in_file(filelist_name);
    261262    mr_free(filelist_name);
    262263
    263264    if (strstr(tarball_fname, ".bz2")) {
    264         mr_asprintf(&compressor_exe, "bzip2");
     265        mr_asprintf(compressor_exe, "bzip2");
    265266    } else if (strstr(tarball_fname, ".gz")) {
    266         mr_asprintf(&compressor_exe, "gzip");
     267        mr_asprintf(compressor_exe, "gzip");
    267268    } else if (strstr(tarball_fname, ".lzo")) {
    268         mr_asprintf(&compressor_exe, "lzop");
     269        mr_asprintf(compressor_exe, "lzop");
    269270    }
    270271
     
    276277
    277278    if (compressor_exe) {
    278         if (!find_home_of_exe(compressor_exe)) {
     279        tmp1 = find_home_of_exe(compressor_exe);
     280        if (!tmp1) {
     281            mr_free(tmp1);
    279282            mr_free(compressor_exe);
    280283            mr_free(archiver_exe);
    281284            fatal_error("(compare_a_tarball) Compression program missing");
    282285        }
     286        mr_free(tmp1);
     287
    283288        if (use_star) {
    284289            if (!strcmp(compressor_exe, "bzip2")) {
     
    292297            // afio
    293298            mr_free(compressor_exe);
    294             mr_asprintf(&tmp, "%s", compressor_exe);
    295             mr_asprintf(&compressor_exe, "-P %s -Z", tmp);
     299            mr_asprintf(tmp, "%s", compressor_exe);
     300            mr_asprintf(compressor_exe, "-P %s -Z", tmp);
    296301            mr_free(tmp);
    297302        }
     
    303308#define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE
    304309#endif
    305     mr_asprintf(&logfile, "/tmp/afio.log.%d", current_tarball_number);
     310    mr_asprintf(logfile, "/tmp/afio.log.%d", current_tarball_number);
    306311
    307312    if (use_star) {
    308313        // doesn't use compressor_exe
    309         mr_asprintf(&command, "%s -diff H=star file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile);
    310     } else {
    311         mr_asprintf(&command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile);
     314        mr_asprintf(command, "%s -diff H=star file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile);
     315    } else {
     316        mr_asprintf(command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile);
    312317    }
    313318    mr_free(compressor_exe);
     
    325330
    326331    if (length_of_file(logfile) > 5) {
    327         mr_asprintf(&command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile);
     332        mr_asprintf(command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile);
    328333        system(command);
    329334        mr_free(command);
     
    365370    long max_val;
    366371
    367     malloc_string(tarball_fname);
    368     malloc_string(progress_str);
    369 
    370372    assert(bkpinfo != NULL);
    371373    mvaddstr_and_log_it(g_currentY, 0, "Comparing archives");
     
    374376    mr_free(tmp);
    375377
    376     paranoid_free(tmp);
    377 
    378378    mds = media_descriptor_string(bkpinfo->backup_media_type);
    379     mr_asprintf(&progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
     379    mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
    380380
    381381    open_progress_form("Comparing files",
     
    389389        insist_on_this_cd_number(g_current_media_number);
    390390        update_progress_form(progress_str);
    391         mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);
     391        mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);
    392392
    393393        if (!does_file_exist(tarball_fname)) {
    394394            mr_free(tarball_fname);
    395             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);
     395            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);
    396396        }
    397397        if (!does_file_exist(tarball_fname)) {
    398398            mr_free(tarball_fname);
    399             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);
     399            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);
    400400        }
    401401        if (!does_file_exist(tarball_fname)) {
    402402            mr_free(tarball_fname);
    403             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);
     403            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);
    404404        }
    405405        if (!does_file_exist(tarball_fname)) {
    406406            mr_free(tarball_fname);
    407             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);
     407            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);
    408408        }
    409409        if (!does_file_exist(tarball_fname)) {
    410410            mr_free(tarball_fname);
    411             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);
     411            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);
    412412        }
    413413        if (!does_file_exist(tarball_fname)) {
     
    424424
    425425            mr_free(progress_str);
    426             mr_asprintf(&progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
     426            mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
    427427            log_to_screen(progress_str);
    428428        } else {
     
    490490    noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt");
    491491    if (noof_changed_files) {
    492         mr_asprintf(&tmp, "%ld files do not match the backup            ", noof_changed_files);
     492        mr_asprintf(tmp, "%ld files do not match the backup            ", noof_changed_files);
    493493        log_to_screen(tmp);
    494494        mr_free(tmp);
    495495
    496         mr_asprintf(&command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);
     496        mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);
    497497        paranoid_system(command);
    498498        mr_free(command);
    499499    } else {
    500         mr_asprintf(&tmp, "All files match the backup                     ");
     500        mr_asprintf(tmp, "All files match the backup                     ");
    501501        mvaddstr_and_log_it(g_currentY++, 0, tmp);
    502502        log_to_screen(tmp);
     
    563563    if (g_text_mode) {
    564564        save_mountlist_to_disk(mountlist, g_mountlist_fname);
    565         mr_asprintf(&tmp, "%s %s", find_my_editor(), g_mountlist_fname);
     565        mr_asprintf(tmp, "%s %s", find_my_editor(), g_mountlist_fname);
    566566        res = system(tmp);
    567567        mr_free(tmp);
     
    612612        } else {
    613613            q = count_lines_in_file(MONDO_CACHE"/changed.files");
    614             mr_asprintf(&tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : "");
     614            mr_asprintf(tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : "");
    615615            mvaddstr_and_log_it(g_currentY++, 0, tmp);
    616616            log_to_screen(tmp);
    617617            mr_free(tmp);
    618618
    619             mr_asprintf(&tmp, "Type 'less /tmp/changed.files' for a list of non-matching files");
     619            mr_asprintf(tmp, "Type 'less /tmp/changed.files' for a list of non-matching files");
    620620            mvaddstr_and_log_it(g_currentY++, 0, tmp);
    621621            log_to_screen(tmp);
     
    723723    getcwd(dir, MAX_STR_LEN);
    724724    chdir(bkpinfo->restore_path);
    725     mr_asprintf(&command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
     725    mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
    726726    run_program_and_log_output(command, FALSE);
    727727    mr_free(command);
  • branches/2.2.10/tools/myval

    r2320 r2332  
    33# Call valgrind to test mondo
    44
    5 sudo valgrind --log-file=/tmp/val.log --show-reachable=yes --leak-check=full /bruno/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -G -I /etc -d /home
    6 sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes --leak-check=full /bruno/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -I /etc -G -g -d /home
     5sudo valgrind --log-file=/tmp/val.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -I /etc -d /home
     6sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I /etc -E /etc/init.d -d /home
  • branches/2.2.10/tools/quality

    r2321 r2332  
    2828
    2929# How many sprintf/strcat/strcpy vs asprintf are they
    30 for s in asprintf mr_asprintf sprintf snprintf strcat strcpy strncpy fgets malloc mr_malloc malloc_string getline mr_getline MAX_STR_LEN getcwd goto free mr_free paranoid_free paranoid_system mr_system assert; do
     30for s in asprintf mr_asprintf sprintf snprintf strcat strncat strcpy strncpy fgets malloc mr_malloc malloc_string getline mr_getline MAX_STR_LEN getcwd goto free mr_free paranoid_free paranoid_system mr_system assert; do
    3131    echo "mondorescue $s usage : "
    3232    tot=0
Note: See TracChangeset for help on using the changeset viewer.