Changeset 2291 in MondoRescue


Ignore:
Timestamp:
Jul 22, 2009, 2:11:26 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Fix a printing error in mindi for the tar command
  • Fix all mr_asprintf which had no second param as a string

(report bug fix done originaly in 2.2.9)

Location:
branches/2.2.10
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/mindi

    r2283 r2291  
    19111911        [ "$?" -ne "0" ] && [ _"$MONDO_SHARE" != _"" ] && Die "Cannot find/install $MONDO_SHARE/restore-scripts"
    19121912    fi
    1913     [ -d "/lib/dev-state" ] && tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "Unable to handle /lib/dev-state" $MINDI_TMP/$$.log
     1913    if [ -d "/lib/dev-state" ]; then
     1914        tar cf - -C / ./lib/dev-state 2>> $MINDI_TMP/$$.log | tar xf - || LogIt "Unable to handle /lib/dev-state" $MINDI_TMP/$$.log
     1915    fi
    19141916    cd $old_pwd
    19151917    echo -e "$DONE"
  • branches/2.2.10/mondo/src/common/libmondo-archive.c

    r2286 r2291  
    226226        log_msg(5, "command='%s'", command);
    227227        res = system(command);
    228         mr_asprintf(&tmp, last_line_of_file(MONDO_LOGFILE));
     228        mr_asprintf(&tmp, "%s", last_line_of_file(MONDO_LOGFILE));
    229229        log_msg(1, "res=%d; tmp='%s'", res, tmp);
    230230        if (bkpinfo->use_star && (res == 254 || res == 65024)
     
    541541
    542542    assert(bkpinfo != NULL);
    543     mr_asprintf(&tmp,
    544             "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'",
     543    mr_asprintf(&tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'",
    545544            bkpinfo->exclude_paths);
    546545    mr_asprintf(&devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));
     
    624623
    625624#ifdef __FreeBSD__
    626         mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     625        mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    627626               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    628627        if (!bootdev[0]) {
    629628            mr_free(bootdev);
    630             mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     629            mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    631630                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    632631        }
     
    634633        /* Linux */
    635634#ifdef __IA64__
    636         mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     635        mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    637636               ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    638637#else
    639         mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     638        mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    640639               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    641640#endif
     
    643642            mr_free(bootdev);
    644643#ifdef __IA64__
    645             mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     644            mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    646645                   ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    647646#else
    648             mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     647            mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    649648                   ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    650649#endif
     
    652651        if (!bootdev[0]) {
    653652            mr_free(bootdev);
    654             mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     653            mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    655654                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    656655            if (strstr(bootdev, "/dev/cciss/")) {
    657656                mr_free(bootdev);
    658                 mr_asprintf(&bootdev, call_program_and_get_last_line_of_output
     657                mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
    659658                       ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    660659            }
     
    667666            ch = 'U';
    668667        if (bkpinfo->boot_loader != '\0') {
    669             mr_asprintf(&tmp, "User specified boot loader. It is '%c'.",
    670                     bkpinfo->boot_loader);
     668            mr_asprintf(&tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
    671669            log_msg(2, tmp);
    672670            mr_free(tmp);
     
    675673        }
    676674        if (bkpinfo->boot_device[0] != '\0') {
    677             mr_asprintf(&tmp, "User specified boot device. It is '%s'.",
    678                     bkpinfo->boot_device);
     675            mr_asprintf(&tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
    679676            log_msg(2, tmp);
    680677            mr_free(tmp);
     
    761758        mr_asprintf(&bootldr_str, "unknown");
    762759    }
    763     mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s",
    764             bootldr_str, bkpinfo->boot_device);
     760    mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    765761    log_to_screen(tmp);
    766762    mr_free(tmp);
     
    862858    estimated_total_noof_slices =
    863859        size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    864 /* add nfs stuff here? */
     860    /* add nfs stuff here? */
    865861    mr_asprintf(&command, "mkdir -p %s/images", bkpinfo->scratchdir);
    866862    if (system(command)) {
     
    14951491                mr_free(media_usage_comment);
    14961492                if (res) {
    1497                     mr_asprintf(&tmp,
    1498                         "Failed to add archive %ld's files to CD dir\n",
     1493                    mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n",
    14991494                        storing_set_no);
    15001495                    log_to_screen(tmp);
     
    17861781                }
    17871782                pause_for_N_seconds(5, "Letting DVD drive settle");
    1788                 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s",
    1789                         bkpinfo->media_device);
     1783                mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    17901784                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    17911785                res =
     
    19761970    bool ret = TRUE;
    19771971
    1978     mr_asprintf(&command,
    1979             "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1",
    1980             bigfile_fname);
     1972    mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
    19811973    log_msg(1, "command = '%s'", command);
    19821974    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    20972089                        "Calling ntfsclone in background because %s is an NTFS partition",
    20982090                        bigfile_fname);
    2099                 mr_asprintf(&sz_devfile, "%s/%d.%d.000",
    2100                         bkpinfo->tmpdir,
     2091                mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir,
    21012092                        (int) (random() % 32768),
    21022093                        (int) (random() % 32768));
     
    22252216        log_msg(1, "EXAT'g set %ld", curr_set_no);
    22262217        if (g_getfattr) {
    2227             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ,
    2228                 bkpinfo->tmpdir, curr_set_no);
     2218            mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22292219            get_fattr_list(curr_filelist_fname, curr_xattr_list_fname);
    22302220        }
    22312221        if (g_getfacl) {
    2232             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ,
    2233                 bkpinfo->tmpdir, curr_set_no);
     2222            mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22342223            get_acl_list(curr_filelist_fname, curr_acl_list_fname);
    22352224        }
     
    22412230        retval += res;
    22422231        if (res) {
    2243             mr_asprintf(&tmp,
    2244                     "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?",
    2245                     curr_set_no);
     2232            mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    22462233            log_to_screen(tmp);
    22472234            mr_free(tmp);
     
    22952282
    22962283        if (res) {
    2297             mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n",
    2298                     curr_set_no);
     2284            mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
    22992285            log_to_screen(tmp);
    23002286            mr_free(tmp);
     
    25052491            continue;
    25062492        }
    2507         mr_asprintf(&curr_file, cf);
     2493        mr_asprintf(&curr_file, "%s", cf);
    25082494        if (!does_file_exist(curr_file)) {
    25092495            log_msg(1,
     
    25342520            continue;
    25352521        }
    2536         mr_asprintf(&curr_file, cf);
     2522        mr_asprintf(&curr_file, "%s", cf);
    25372523
    25382524        mr_asprintf(&tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
     
    26092595            continue;
    26102596        }
    2611         mr_asprintf(&curr_file, cf);
     2597        mr_asprintf(&curr_file, "%s", cf);
    26122598        if (!does_file_exist(curr_file)) {
    26132599            log_msg(1,
     
    26672653    char *cdrecord = NULL;
    26682654
    2669     mr_asprintf(&bkp, cdrw_dev);
     2655    mr_asprintf(&bkp, "%s", cdrw_dev);
    26702656    if (find_cdrw_device(cdrw_dev)) {
    26712657        strcpy(cdrw_dev, bkp);
     
    28262812        eject_device(cdrom_dev);
    28272813        mds = media_descriptor_string(g_backup_media_type);
    2828         mr_asprintf(&tmp,
    2829                 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
     2814        mr_asprintf(&tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
    28302815                mds, g_current_media_number, mds);
    28312816        mr_free(mds);
     
    29952980        mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
    29962981        log_it("command = %s", command);
    2997         mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2982        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    29982983        mr_free(command);
    29992984        log_it("res of it = %s", tmp);
     
    30283013    strcpy(biggiestruct.checksum, checksum_line);
    30293014
    3030     mr_asprintf(&tmp, slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
     3015    mr_asprintf(&tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
    30313016    fout = fopen(tmp, "w");
    30323017    if (fout == NULL) {
     
    30693054    }
    30703055    for (slice_num = 1; !finished; slice_num++) {
    3071         mr_asprintf(&curr_slice_fname_uncompressed, "%s",
    3072                slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir,
    3073                            ""));
    3074         mr_asprintf(&curr_slice_fname_compressed, "%s",
    3075                slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir,
    3076                            suffix));
    3077 
    3078         mr_asprintf(&tmp, percent_media_full_comment());
     3056        mr_asprintf(&curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
     3057        mr_asprintf(&curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
     3058
     3059        mr_asprintf(&tmp, "%s", percent_media_full_comment());
    30793060        update_progress_form(tmp);
    30803061        paranoid_free(tmp);
     
    31083089            }
    31093090            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
    3110                 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe,
    3111                         bkpinfo->compression_level,
    3112                         curr_slice_fname_uncompressed);
     3091                mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
    31133092                log_msg(2, command);
    31143093                if ((res = system(command))) {
     
    31173096                //          did_I_compress_slice = TRUE;
    31183097            } else {
    3119                 mr_asprintf(&command, "mv %s %s 2>> %s",
    3120                         curr_slice_fname_uncompressed,
    3121                         curr_slice_fname_compressed, MONDO_LOGFILE);
     3098                mr_asprintf(&command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
    31223099                res = 0;        // don't do it :)
    31233100                //          did_I_compress_slice = FALSE;
     
    31373114                mr_asprintf(&tmp, "Problem with slice # %ld", slice_num);
    31383115            } else {
    3139                 mr_asprintf(&tmp,
    3140                         "%s - Bigfile #%ld, slice #%ld compressed OK          ",
    3141                         biggie_filename, biggie_file_number + 1,
     3116                mr_asprintf(&tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1,
    31423117                        slice_num);
    31433118            }
     
    31543129            paranoid_free(tmp);
    31553130
    3156             mr_asprintf(&file_to_archive, curr_slice_fname_compressed);
     3131            mr_asprintf(&file_to_archive, "%s", curr_slice_fname_compressed);
    31573132            g_current_progress++;
    31583133        } else {                /* if i==0 then ... */
    31593134
    31603135            finished = TRUE;
    3161             mr_asprintf(&file_to_archive, curr_slice_fname_uncompressed);
     3136            mr_asprintf(&file_to_archive, "%s", curr_slice_fname_uncompressed);
    31623137            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    31633138                break;
     
    31803155        retval += res;
    31813156        if (res) {
    3182             mr_asprintf(&tmp,
    3183                     "Failed to add slice %ld of bigfile %ld to scratchdir",
    3184                     slice_num, biggie_file_number + 1);
     3157            mr_asprintf(&tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    31853158            log_to_screen(tmp);
    31863159            paranoid_free(tmp);
     
    35293502            if (res) {
    35303503                mds = media_descriptor_string(bkpinfo->backup_media_type);
    3531                 mr_asprintf(&tmp,
    3532                         "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3504                mr_asprintf(&tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    35333505                mr_free(mds);
    35343506                log_to_screen(tmp);
     
    35373509            }
    35383510        }
    3539         mr_asprintf(&tmp,
    3540                 "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files",
    3541                 MONDO_LOGFILE, MONDO_CACHE);
     3511        mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    35423512        (void)system(tmp);
    35433513        mr_free(tmp);
    35443514
    3545         mr_asprintf(&tmp,
    3546                 "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files",
    3547                 MONDO_LOGFILE, MONDO_CACHE);
     3515        mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    35483516        (void)system(tmp);
    35493517        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2273 r2291  
    364364
    365365    log_msg(5, "dsf: %s", dsf);
    366    
     366
    367367    /********
    368368    * See if a device special file was passed in (i.e. it must start with /dev/
     
    388388    }
    389389    log_msg(5, "  %s device special file exists", dsf);
    390    
     390
    391391    /* Get a list of the mounted file systems */
    392392    if (create_list_of_non_NFS_mounted_file_systems()) {
     
    400400    * Either way, it's an error.
    401401    ********/
    402     mr_asprintf(&command,
    403       "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     402    mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    404403    log_msg(4, "Executing: %s", command);
    405404    mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command));
     
    454453        log_msg(4, "Processing partition: %s", partitions[i]);
    455454        /* See if it's swap. If it is, ignore it. */
    456         mr_asprintf(&command,
    457           "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
     455        mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    458456          dsf, partitions[i]);
    459457        log_msg(4, "  Running: %s", command);
     
    492490        if (strlen(tmp)) {
    493491            log_msg(4, "  Partition ID: %s", tmp);
    494             if (!strcasecmp(tmp, "8e")) { 
     492            if (!strcasecmp(tmp, "8e")) {
    495493                /* It's LVM: Find the VG it's in */
    496494                log_msg(4, "  It's LVM: Find the VG it's in...");
     
    503501                    /* Found the Volume Group. Now find all of the VG's mount points */
    504502                    log_msg(4, "  Found the Volume Group. Now find all of the VG's mount points");
    505                     mr_asprintf(&command,
    506                       "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'",
    507                       VG, VG);
     503                    mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    508504                    log_msg(4, "  Running: %s", command);
    509505                    mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     
    527523                     *******/
    528524                    paranoid_free(mount_list);
    529                     mr_asprintf(&command, "%s",
    530                         "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     525                    mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    531526                    log_msg (5, "Running: %s", command);
    532527                    mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
    533528                    paranoid_free(command);
    534                     log_msg(4, "  Software raid device list: %s", mount_list);   
     529                    log_msg(4, "  Software raid device list: %s", mount_list);
    535530                    lastpos = 0;
    536531                    while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    537                         mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 
     532                        mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
    538533                        log_msg (5, "Running: %s", command);
    539534                        paranoid_free(tmp);
     
    581576        log_msg (5, "  UUID: %s", tmp);
    582577        /* Get the Software raid device list */
    583         mr_asprintf(&command, "%s",
    584          "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     578        mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    585579        log_msg (5, "  Running: %s", command);
    586580        mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
    587581        paranoid_free(command);
    588         log_msg(4, "  Software raid device list: %s", mount_list);   
     582        log_msg(4, "  Software raid device list: %s", mount_list);
    589583        /* Loop through the software raid device list to see if we can find the partition */
    590584        lastpos = 0;
     
    770764            strcat(bkpinfo->include_paths, " ");
    771765        }
    772        
     766
    773767        mr_asprintf(&tmp1, "%s", flag_val['I']);
    774768        p = tmp1;
     
    15341528            if (flag_set[opt]) {
    15351529                bad_switches = TRUE;
    1536                 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt,
    1537                         flag_val[opt]);
     1530                mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    15381531                log_to_screen(tmp);
    15391532                paranoid_free(tmp);
     
    15511544                        if (strchr(flag_val[opt], '/')
    15521545                            && flag_val[opt][0] != '/') {
    1553                             mr_asprintf(&tmp,
    1554                                     "-%c flag --- must be absolute path --- '%s' isn't absolute",
    1555                                     opt, flag_val[opt]);
     1546                            mr_asprintf(&tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    15561547                            log_to_screen(tmp);
    15571548                            paranoid_free(tmp);
     
    16241615    case SIGABRT:
    16251616        mr_asprintf(&tmp, "SIGABRT");
    1626         mr_asprintf(&tmp2,
    1627                 "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
     1617        mr_asprintf(&tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
    16281618        break;
    16291619    default:
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2266 r2291  
    11421142    mr_free(device_with_space);
    11431143    paranoid_pclose(fin);
    1144     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null",
    1145             SWAPLIST_COMMAND, device_with_space);
     1144    mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11461145    log_msg(4, "tmp (command) = '%s'", tmp);
    11471146    if (!system(tmp)) {
     
    12921291
    12931292#ifdef __FreeBSD__
    1294         mr_asprintf(&dev, make_vn(device));
     1293        mr_asprintf(&dev, "%s", make_vn(device));
    12951294        if (!dev) {
    12961295            mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     
    13091308
    13101309#ifdef __FreeBSD__
    1311     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",
    1312             device, mountpoint, MONDO_LOGFILE);
     1310    mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    13131311
    13141312#else
    1315     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s",
    1316             device, options, mountpoint, MONDO_LOGFILE);
     1313    mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    13171314    paranoid_free(options);
    13181315#endif
     
    16091606            if (bkpinfo->media_device[0]) {
    16101607                if (bkpinfo->backup_media_type == usb) {
    1611                     mr_asprintf(&tmp,
    1612                         "I think your %s media corresponds to %s. Is this correct?", mds,
    1613                         bkpinfo->media_device);
     1608                    mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    16141609                } else {
    1615                     mr_asprintf(&tmp,
    1616                         "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds,
    1617                         bkpinfo->media_device);
     1610                    mr_asprintf(&tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);
    16181611                }
    16191612                if (!ask_me_yes_or_no(tmp)) {
     
    16831676        }
    16841677        if (bkpinfo->media_device[0]) {
    1685             mr_asprintf(&tmp,
    1686                     "I think I've found your tape streamer at %s; am I right on the money?",
    1687                     bkpinfo->media_device);
     1678            mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16881679            if (!ask_me_yes_or_no(tmp)) {
    16891680                bkpinfo->media_device[0] = '\0';
     
    18121803            mr_free(command);
    18131804
    1814             mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount,
    1815                     bkpinfo->isodir);
     1805            mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    18161806            run_program_and_log_output(tmp, 3);
    18171807            mr_free(tmp);
     
    18251815            finish(1);
    18261816        }
    1827         mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);
     1817        mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir);
    18281818        if (!popup_and_get_string
    18291819            ("Directory", "Which directory within that mountpoint?", tmp,
     
    19771967        mr_free(tmp);
    19781968// NTFS
    1979         mr_asprintf(&tmp, "%s",
    1980                call_program_and_get_last_line_of_output
    1981                ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1969        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    19821970        if (strlen(tmp) > 2) {
    19831971            if (!popup_and_get_string
     
    21052093
    21062094    mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2107     mr_asprintf(&exclude_these_devices,"%s",
    2108            call_program_and_get_last_line_of_output
    2109            ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2095    mr_asprintf(&exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    21102096    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    21112097    mr_free(exclude_these_devices);
     
    21282114    static char result_sz[512];
    21292115
    2130     mr_asprintf(&exclude_these_directories,"%s",
    2131            call_program_and_get_last_line_of_output
    2132            ("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2116    mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
    21332117    snprintf(result_sz, 511, "%s", exclude_these_directories);
    21342118    mr_free(exclude_these_directories);
     
    21842168
    21852169#ifdef __FreeBSD__
    2186     mr_asprintf(&tmp,
    2187            call_program_and_get_last_line_of_output
    2188            ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2170    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    21892171#else
    2190     mr_asprintf(&tmp,
    2191            call_program_and_get_last_line_of_output
    2192            ("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2172    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    21932173#endif
    21942174
    21952175    if (tmp[0] != '/') {
    2196         mr_asprintf(&sz, tmp);
     2176        mr_asprintf(&sz, "%s", tmp);
    21972177        paranoid_free(tmp);
    21982178        mr_asprintf(&tmp, "/%s", sz);
     
    22922272    }
    22932273
    2294     mr_asprintf(&mountdev, bkpinfo->media_device);
     2274    mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
    22952275    if (!mountdev[0]) {
    22962276        log_it
     
    24252405    assert(which_device != NULL);
    24262406
    2427     mr_asprintf(&list_drives_cmd,
    2428             "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s",
    2429             where_is_root_mounted());
     2407    mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
    24302408    log_it("list_drives_cmd = %s", list_drives_cmd);
    24312409
     
    24692447    } else {
    24702448        // We need to look on each partition then
    2471         mr_asprintf(&list_drives_cmd,
    2472             "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2449        mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    24732450        log_it("list_drives_cmd = %s", list_drives_cmd);
    24742451
     
    25722549            log_msg(1, "curr_fname = %s", curr_fname);
    25732550            mr_asprintf(&command, "file %s", curr_fname);
    2574             mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2551            mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    25752552            mr_free(command);
    25762553            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    25772554                 p--);
    25782555            p++;
    2579             mr_asprintf(&scratch, p);
     2556            mr_asprintf(&scratch, "%s", p);
    25802557            for (p = scratch; *p != '\0' && *p != '\''; p++);
    25812558            *p = '\0';
     
    26262603    mr_free(fdisk);
    26272604
    2628     mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2605    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    26292606    mr_free(command);
    26302607
  • branches/2.2.10/mondo/src/common/libmondo-fifo.c

    r2263 r2291  
    167167    }
    168168    paranoid_system("sync");
    169     mr_asprintf(&command,
    170             "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
     169    mr_asprintf(&command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
    171170    log_msg(2, "kill_buffer() --- command = %s", command);
    172     mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     171    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    173172    mr_free(command);
    174173
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2287 r2291  
    13931393#if linux
    13941394        // 2.6 has /sys as a proc-type thing -- must be excluded
    1395         mr_asprintf(&strtmp,
    1396              "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null",
    1397              dir, find_excludes, g_skeleton_filelist);
     1395        mr_asprintf(&strtmp, "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);
    13981396#else
    13991397        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1400         mr_asprintf(&strtmp,
    1401              "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null",
    1402                 dir, find_excludes, g_skeleton_filelist);
     1398        mr_asprintf(&strtmp, "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);
    14031399#endif
    14041400        paranoid_free(find_excludes);
     
    14901486                                counter = 0;
    14911487                                uberctr++;
    1492                                 mr_asprintf(&tmp, " %c ",
    1493                                         special_dot_char(uberctr));
     1488                                mr_asprintf(&tmp, " %c ", special_dot_char(uberctr));
    14941489#ifndef _XWIN
    14951490                                if (!g_text_mode) {
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2261 r2291  
    554554            (drivelist->el[i].device,
    555555             DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) {
    556             mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)",
    557                     drivelist->el[i].device);
     556            mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
    558557            log_it(tmp);
    559558            paranoid_free(tmp);
     
    644643        if (copies > 1 && last_copy == currline
    645644            && strcmp(curr_mountpoint, "raid")) {
    646             mr_asprintf(&tmp, " %s %s's.", number_to_text(copies),
    647                     curr_mountpoint);
     645            mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
    648646            mr_strcat(flaws_str, "%s", tmp);
    649647            log_it(tmp);
     
    771769                       (void *) &mountlist->el[i],
    772770                       sizeof(struct mountlist_line));
    773                 mr_asprintf(&tmp,
    774                          "%s is available; user may choose to add it to raid device",
    775                          output_list->el[items - 1].device);
     771                mr_asprintf(&tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
    776772                log_it(tmp);
    777773                paranoid_free(tmp);
     
    891887            if (j < items) {
    892888                strcat(mountlist->el[items].device, "_dup");
    893                 mr_asprintf(&tmp,
    894                          "Duplicate entry in mountlist - renaming to %s",
    895                          mountlist->el[items].device);
     889                mr_asprintf(&tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    896890                log_it(tmp);
    897891                paranoid_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2270 r2291  
    672672                retval++;
    673673            } else {
    674                 mr_asprintf(&ip_address, inet_ntoa
    675                        ((struct in_addr)
    676                         *((struct in_addr *) hent->h_addr)));
     674                mr_asprintf(&ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    677675                mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':'));
    678676                strcpy(bkpinfo->nfs_mount, ip_address);
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2279 r2291  
    224224        newtFormDestroy(g_isoform_main);
    225225        newtPopWindow();
     226
     227        /* Reset globals */
    226228        g_isoform_main = NULL;
    227229        g_isoform_old_progress = -1;
    228     }
    229 
     230        g_isoform_header = NULL;
     231        g_isoform_scale = NULL;
     232        g_isoform_timeline = NULL;
     233        g_isoform_pcline = NULL;
     234}
    230235
    231236/**
     
    252257        newtFormDestroy(g_progressForm);
    253258        newtPopWindow();
     259
     260        /* Reset globals */
    254261        g_progressForm = NULL;
    255262        g_current_progress = -999;
     263        g_timeline = NULL;
     264        g_percentline = NULL;
     265        g_scale = NULL;
     266
    256267    }
    257268
     
    288299        char *command;
    289300        static bool already_exiting = FALSE;
    290         int i;
    291301
    292302        /*@ end vars **************************************************** */
  • branches/2.2.10/mondo/src/lib/mr_conf.c

    r1594 r2291  
    108108    CONF = fopen(filename, "r");
    109109
    110     mr_asprintf(&mr_conf_filename,filename);
     110    mr_asprintf(&mr_conf_filename, "%s", filename);
    111111
    112112    /*if file is empty or not exist => error */
     
    232232        return(p);
    233233    }
    234     mr_asprintf(&q, p);
     234    mr_asprintf(&q, "%s", p);
    235235
    236236    if (*p != '"') {
  • branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c

    r2241 r2291  
    364364        retval += res;
    365365        if (res) {
    366             mr_asprintf(&say_at_end,
    367                    "Data archived. Please check the logs, just as a precaution. ");
     366            mr_asprintf(&say_at_end, "Data archived. Please check the logs, just as a precaution. ");
    368367        } else {
    369368            mr_asprintf(&say_at_end, "Data archived OK. ");
     
    377376            mr_asprintf(&tmp, "%d difference%c found.", -res,
    378377                    (-res != 1) ? 's' : ' ');
    379             mr_asprintf(&say_at_end, tmp);
     378            mr_asprintf(&say_at_end, "%s", tmp);
    380379            log_to_screen(tmp);
    381380            mr_free(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

    r2282 r2291  
    615615  // - faulty devices ignored
    616616  // - persistent superblock always used as this is recommended
    617   mr_asprintf(&program,
    618        "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d",
    619        raidlist->el[i].raid_device, level,
    620        raidlist->el[i].data_disks.entries);
     617  mr_asprintf(&program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);
    621618  if (raidlist->el[i].parity != -1) {
    622619    mr_asprintf(&strtmp, "%s", program);
     
    709706#endif
    710707    if (strlen(format) <= 2) {
    711         mr_asprintf(&tmp,
    712                 "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it",
    713                 device, format);
     708        mr_asprintf(&tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);
    714709        log_it(tmp);
    715710        paranoid_free(tmp);
     
    774769
    775770                while (1) {
    776                     mr_asprintf(&tmp,
    777                             "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'",
    778                             line);
     771                    mr_asprintf(&tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line);
    779772                    FILE *pin = popen(tmp, "r");
    780773                    paranoid_free(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2242 r2291  
    8181            insist_on_this_cd_number((++g_current_media_number));
    8282        } else {
    83             mr_asprintf(&tmp_ptr,
    84                     "No CD's left. No biggiefiles left. No prob, Bob.");
     83            mr_asprintf(&tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");
    8584            log_msg(2, tmp_ptr);
    8685            paranoid_free(tmp_ptr);
     
    8988    }
    9089    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
    91         mr_asprintf(&tmp_ptr,
    92                 "Cannot open bigfile %ld (%s)'s info file",
    93                 bigfileno + 1, bigfile_fname_ptr);
     90        mr_asprintf(&tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
    9491        log_to_screen(tmp_ptr);
    9592        paranoid_free(tmp_ptr);
     
    148145        }
    149146    }
    150     mr_asprintf(&tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1,
    151             bigfile_fname_ptr);
     147    mr_asprintf(&tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);
    152148    if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) {
    153149        mr_strcat(tmp_ptr, " ... OK");
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2287 r2291  
    17251725
    17261726        if (use_star) {
    1727             mr_asprintf(&command,
    1728                     "star -x -force-remove -U " STAR_ACL_SZ
    1729                     " errctl= file=%s", tarball_fname);
     1727            mr_asprintf(&command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
    17301728            if (strstr(tarball_fname, ".bz2")) {
    17311729                mr_strcat(command, " -bz");
     
    17361734            } else {
    17371735                if (filelist_subset_fname != NULL) {
    1738                     mr_asprintf(&command,
    1739                         "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s",
    1740                         TAPE_BLOCK_SIZE,
    1741                         BUFSIZE, executable, filelist_subset_fname,
    1742                         tarball_fname);
     1736                    mr_asprintf(&command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);
    17431737                } else {
    1744                     mr_asprintf(&command,
    1745                         "afio -i -b %ld -c %ld -M 8m %s %s",
    1746                         TAPE_BLOCK_SIZE,
    1747                         BUFSIZE, executable, tarball_fname);
     1738                    mr_asprintf(&command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
    17481739                }
    17491740            }
Note: See TracChangeset for help on using the changeset viewer.