Changeset 2290


Ignore:
Timestamp:
Jul 22, 2009, 2:03:44 PM (10 years ago)
Author:
bruno
Message:
  • Fix a printing error in mindi for the tar command
  • Fix all mr_asprintf which had no second param as a string
Location:
branches/2.2.9
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi/mindi

    r2248 r2290  
    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.9/mondo/src/common/libmondo-archive.c

    r2285 r2290  
    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)) {
     
    15091505                mr_free(media_usage_comment);
    15101506                if (res) {
    1511                     mr_asprintf(&tmp,
    1512                         "Failed to add archive %ld's files to CD dir\n",
     1507                    mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n",
    15131508                        storing_set_no);
    15141509                    log_to_screen(tmp);
     
    17961791                }
    17971792                pause_for_N_seconds(5, "Letting DVD drive settle");
    1798                 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s",
    1799                         bkpinfo->media_device);
     1793                mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    18001794                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    18011795                res =
     
    19851979    bool ret = TRUE;
    19861980
    1987     mr_asprintf(&command,
    1988             "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1",
    1989             bigfile_fname);
     1981    mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
    19901982    log_msg(1, "command = '%s'", command);
    19911983    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    21062098                        "Calling ntfsclone in background because %s is an NTFS partition",
    21072099                        bigfile_fname);
    2108                 mr_asprintf(&sz_devfile, "%s/%d.%d.000",
    2109                         bkpinfo->tmpdir,
     2100                mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir,
    21102101                        (int) (random() % 32768),
    21112102                        (int) (random() % 32768));
     
    22342225        log_msg(1, "EXAT'g set %ld", curr_set_no);
    22352226        if (g_getfattr) {
    2236             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ,
    2237                 bkpinfo->tmpdir, curr_set_no);
     2227            mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22382228            get_fattr_list(curr_filelist_fname, curr_xattr_list_fname);
    22392229        }
    22402230        if (g_getfacl) {
    2241             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ,
    2242                 bkpinfo->tmpdir, curr_set_no);
     2231            mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22432232            get_acl_list(curr_filelist_fname, curr_acl_list_fname);
    22442233        }
     
    22502239        retval += res;
    22512240        if (res) {
    2252             mr_asprintf(&tmp,
    2253                     "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?",
    2254                     curr_set_no);
     2241            mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    22552242            log_to_screen(tmp);
    22562243            mr_free(tmp);
     
    23042291
    23052292        if (res) {
    2306             mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n",
    2307                     curr_set_no);
     2293            mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
    23082294            log_to_screen(tmp);
    23092295            mr_free(tmp);
     
    25142500            continue;
    25152501        }
    2516         mr_asprintf(&curr_file, cf);
     2502        mr_asprintf(&curr_file, "%s", cf);
    25172503        if (!does_file_exist(curr_file)) {
    25182504            log_msg(1,
     
    25432529            continue;
    25442530        }
    2545         mr_asprintf(&curr_file, cf);
     2531        mr_asprintf(&curr_file, "%s", cf);
    25462532
    25472533        mr_asprintf(&tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
     
    26182604            continue;
    26192605        }
    2620         mr_asprintf(&curr_file, cf);
     2606        mr_asprintf(&curr_file, "%s", cf);
    26212607        if (!does_file_exist(curr_file)) {
    26222608            log_msg(1,
     
    26762662    char *cdrecord = NULL;
    26772663
    2678     mr_asprintf(&bkp, cdrw_dev);
     2664    mr_asprintf(&bkp, "%s", cdrw_dev);
    26792665    if (find_cdrw_device(cdrw_dev)) {
    26802666        strcpy(cdrw_dev, bkp);
     
    28352821        eject_device(cdrom_dev);
    28362822        mds = media_descriptor_string(g_backup_media_type);
    2837         mr_asprintf(&tmp,
    2838                 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
     2823        mr_asprintf(&tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
    28392824                mds, g_current_media_number, mds);
    28402825        mr_free(mds);
     
    30042989        mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
    30052990        log_it("command = %s", command);
    3006         mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2991        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    30072992        mr_free(command);
    30082993        log_it("res of it = %s", tmp);
     
    30373022    strcpy(biggiestruct.checksum, checksum_line);
    30383023
    3039     mr_asprintf(&tmp, slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
     3024    mr_asprintf(&tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
    30403025    fout = fopen(tmp, "w");
    30413026    if (fout == NULL) {
     
    30783063    }
    30793064    for (slice_num = 1; !finished; slice_num++) {
    3080         mr_asprintf(&curr_slice_fname_uncompressed, "%s",
    3081                slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir,
    3082                            ""));
    3083         mr_asprintf(&curr_slice_fname_compressed, "%s",
    3084                slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir,
    3085                            suffix));
    3086 
    3087         mr_asprintf(&tmp, percent_media_full_comment());
     3065        mr_asprintf(&curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
     3066        mr_asprintf(&curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
     3067
     3068        mr_asprintf(&tmp, "%s", percent_media_full_comment());
    30883069        update_progress_form(tmp);
    30893070        paranoid_free(tmp);
     
    31173098            }
    31183099            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
    3119                 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe,
    3120                         bkpinfo->compression_level,
    3121                         curr_slice_fname_uncompressed);
     3100                mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
    31223101                log_msg(2, command);
    31233102                if ((res = system(command))) {
     
    31263105                //          did_I_compress_slice = TRUE;
    31273106            } else {
    3128                 mr_asprintf(&command, "mv %s %s 2>> %s",
    3129                         curr_slice_fname_uncompressed,
    3130                         curr_slice_fname_compressed, MONDO_LOGFILE);
     3107                mr_asprintf(&command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
    31313108                res = 0;        // don't do it :)
    31323109                //          did_I_compress_slice = FALSE;
     
    31463123                mr_asprintf(&tmp, "Problem with slice # %ld", slice_num);
    31473124            } else {
    3148                 mr_asprintf(&tmp,
    3149                         "%s - Bigfile #%ld, slice #%ld compressed OK          ",
    3150                         biggie_filename, biggie_file_number + 1,
     3125                mr_asprintf(&tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1,
    31513126                        slice_num);
    31523127            }
     
    31633138            paranoid_free(tmp);
    31643139
    3165             mr_asprintf(&file_to_archive, curr_slice_fname_compressed);
     3140            mr_asprintf(&file_to_archive, "%s", curr_slice_fname_compressed);
    31663141            g_current_progress++;
    31673142        } else {                /* if i==0 then ... */
    31683143
    31693144            finished = TRUE;
    3170             mr_asprintf(&file_to_archive, curr_slice_fname_uncompressed);
     3145            mr_asprintf(&file_to_archive, "%s", curr_slice_fname_uncompressed);
    31713146            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    31723147                break;
     
    31893164        retval += res;
    31903165        if (res) {
    3191             mr_asprintf(&tmp,
    3192                     "Failed to add slice %ld of bigfile %ld to scratchdir",
    3193                     slice_num, biggie_file_number + 1);
     3166            mr_asprintf(&tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    31943167            log_to_screen(tmp);
    31953168            paranoid_free(tmp);
     
    35323505            if (res) {
    35333506                mds = media_descriptor_string(bkpinfo->backup_media_type);
    3534                 mr_asprintf(&tmp,
    3535                         "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3507                mr_asprintf(&tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    35363508                mr_free(mds);
    35373509                log_to_screen(tmp);
     
    35403512            }
    35413513        }
    3542         mr_asprintf(&tmp,
    3543                 "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files",
    3544                 MONDO_LOGFILE, MONDO_CACHE);
     3514        mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    35453515        (void)system(tmp);
    35463516        mr_free(tmp);
    35473517
    3548         mr_asprintf(&tmp,
    3549                 "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files",
    3550                 MONDO_LOGFILE, MONDO_CACHE);
     3518        mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    35513519        (void)system(tmp);
    35523520        mr_free(tmp);
  • branches/2.2.9/mondo/src/common/libmondo-cli.c

    r2241 r2290  
    362362
    363363    log_msg(5, "dsf: %s", dsf);
    364    
     364
    365365    /********
    366366    * See if a device special file was passed in (i.e. it must start with /dev/
     
    386386    }
    387387    log_msg(5, "  %s device special file exists", dsf);
    388    
     388
    389389    /* Get a list of the mounted file systems */
    390390    if (create_list_of_non_NFS_mounted_file_systems()) {
     
    398398    * Either way, it's an error.
    399399    ********/
    400     mr_asprintf(&command,
    401       "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     400    mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    402401    log_msg(4, "Executing: %s", command);
    403402    mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command));
     
    452451        log_msg(4, "Processing partition: %s", partitions[i]);
    453452        /* See if it's swap. If it is, ignore it. */
    454         mr_asprintf(&command,
    455           "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
     453        mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    456454          dsf, partitions[i]);
    457455        log_msg(4, "  Running: %s", command);
     
    490488        if (strlen(tmp)) {
    491489            log_msg(4, "  Partition ID: %s", tmp);
    492             if (!strcasecmp(tmp, "8e")) { 
     490            if (!strcasecmp(tmp, "8e")) {
    493491                /* It's LVM: Find the VG it's in */
    494492                log_msg(4, "  It's LVM: Find the VG it's in...");
     
    501499                    /* Found the Volume Group. Now find all of the VG's mount points */
    502500                    log_msg(4, "  Found the Volume Group. Now find all of the VG's mount points");
    503                     mr_asprintf(&command,
    504                       "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'",
    505                       VG, VG);
     501                    mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    506502                    log_msg(4, "  Running: %s", command);
    507503                    mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     
    525521                     *******/
    526522                    paranoid_free(mount_list);
    527                     mr_asprintf(&command, "%s",
    528                         "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     523                    mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    529524                    log_msg (5, "Running: %s", command);
    530525                    mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
    531526                    paranoid_free(command);
    532                     log_msg(4, "  Software raid device list: %s", mount_list);   
     527                    log_msg(4, "  Software raid device list: %s", mount_list);
    533528                    lastpos = 0;
    534529                    while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    535                         mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 
     530                        mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
    536531                        log_msg (5, "Running: %s", command);
    537532                        paranoid_free(tmp);
     
    579574        log_msg (5, "  UUID: %s", tmp);
    580575        /* Get the Software raid device list */
    581         mr_asprintf(&command, "%s",
    582          "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     576        mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    583577        log_msg (5, "  Running: %s", command);
    584578        mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
    585579        paranoid_free(command);
    586         log_msg(4, "  Software raid device list: %s", mount_list);   
     580        log_msg(4, "  Software raid device list: %s", mount_list);
    587581        /* Loop through the software raid device list to see if we can find the partition */
    588582        lastpos = 0;
     
    767761            strcat(bkpinfo->include_paths, " ");
    768762        }
    769        
     763
    770764        mr_asprintf(&tmp1, "%s", flag_val['I']);
    771765        p = tmp1;
     
    15141508            if (flag_set[opt]) {
    15151509                bad_switches = TRUE;
    1516                 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt,
    1517                         flag_val[opt]);
     1510                mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    15181511                log_to_screen(tmp);
    15191512                paranoid_free(tmp);
     
    15311524                        if (strchr(flag_val[opt], '/')
    15321525                            && flag_val[opt][0] != '/') {
    1533                             mr_asprintf(&tmp,
    1534                                     "-%c flag --- must be absolute path --- '%s' isn't absolute",
    1535                                     opt, flag_val[opt]);
     1526                            mr_asprintf(&tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    15361527                            log_to_screen(tmp);
    15371528                            paranoid_free(tmp);
     
    16041595    case SIGABRT:
    16051596        mr_asprintf(&tmp, "SIGABRT");
    1606         mr_asprintf(&tmp2,
    1607                 "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
     1597        mr_asprintf(&tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
    16081598        break;
    16091599    default:
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2257 r2290  
    11481148    mr_free(device_with_space);
    11491149    paranoid_pclose(fin);
    1150     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null",
    1151             SWAPLIST_COMMAND, device_with_space);
     1150    mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11521151    log_msg(4, "tmp (command) = '%s'", tmp);
    11531152    if (!system(tmp)) {
     
    12981297
    12991298#ifdef __FreeBSD__
    1300         mr_asprintf(&dev, make_vn(device));
     1299        mr_asprintf(&dev, "%s", make_vn(device));
    13011300        if (!dev) {
    13021301            mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     
    13151314
    13161315#ifdef __FreeBSD__
    1317     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",
    1318             device, mountpoint, MONDO_LOGFILE);
     1316    mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    13191317
    13201318#else
    1321     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s",
    1322             device, options, mountpoint, MONDO_LOGFILE);
     1319    mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    13231320    paranoid_free(options);
    13241321#endif
     
    16081605            if (bkpinfo->media_device[0]) {
    16091606                if (bkpinfo->backup_media_type == usb) {
    1610                     mr_asprintf(&tmp,
    1611                         "I think your %s media corresponds to %s. Is this correct?", mds,
    1612                         bkpinfo->media_device);
     1607                    mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    16131608                } else {
    1614                     mr_asprintf(&tmp,
    1615                         "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,
    1616                         bkpinfo->media_device);
     1609                    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);
    16171610                }
    16181611                if (!ask_me_yes_or_no(tmp)) {
     
    16821675        }
    16831676        if (bkpinfo->media_device[0]) {
    1684             mr_asprintf(&tmp,
    1685                     "I think I've found your tape streamer at %s; am I right on the money?",
    1686                     bkpinfo->media_device);
     1677            mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16871678            if (!ask_me_yes_or_no(tmp)) {
    16881679                bkpinfo->media_device[0] = '\0';
     
    18111802            sprintf(command, "mkdir -p %s", bkpinfo->isodir);
    18121803            run_program_and_log_output(command, 5);
    1813             mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount,
    1814                     bkpinfo->isodir);
     1804            mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    18151805            run_program_and_log_output(tmp, 3);
    18161806            mr_free(tmp);
     
    18241814            finish(1);
    18251815        }
    1826         mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);
     1816        mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir);
    18271817        if (!popup_and_get_string
    18281818            ("Directory", "Which directory within that mountpoint?", tmp,
     
    19761966        mr_free(tmp);
    19771967// NTFS
    1978         mr_asprintf(&tmp, "%s",
    1979                call_program_and_get_last_line_of_output
    1980                ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1968        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};'"));
    19811969        if (strlen(tmp) > 2) {
    19821970            if (!popup_and_get_string
     
    21062094
    21072095    mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2108     mr_asprintf(&exclude_these_devices,"%s",
    2109            call_program_and_get_last_line_of_output
    2110            ("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;}'"));
     2096    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;}'"));
    21112097    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    21122098    mr_free(exclude_these_devices);
     
    21292115    static char result_sz[512];
    21302116
    2131     mr_asprintf(&exclude_these_directories,"%s",
    2132            call_program_and_get_last_line_of_output
    2133            ("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;}'"));
     2117    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;}'"));
    21342118    snprintf(result_sz, 511, "%s", exclude_these_directories);
    21352119    mr_free(exclude_these_directories);
     
    21862170
    21872171#ifdef __FreeBSD__
    2188     mr_asprintf(&tmp,
    2189            call_program_and_get_last_line_of_output
    2190            ("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;}'"));
     2172    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;}'"));
    21912173#else
    2192     mr_asprintf(&tmp,
    2193            call_program_and_get_last_line_of_output
    2194            ("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;}'"));
     2174    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;}'"));
    21952175#endif
    21962176
    21972177    if (tmp[0] != '/') {
    2198         mr_asprintf(&sz, tmp);
     2178        mr_asprintf(&sz, "%s", tmp);
    21992179        paranoid_free(tmp);
    22002180        mr_asprintf(&tmp, "/%s", sz);
     
    22942274    }
    22952275
    2296     mr_asprintf(&mountdev, bkpinfo->media_device);
     2276    mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
    22972277    if (!mountdev[0]) {
    22982278        log_it
     
    24272407    assert(which_device != NULL);
    24282408
    2429     mr_asprintf(&list_drives_cmd,
    2430             "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s",
    2431             where_is_root_mounted());
     2409    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());
    24322410    log_it("list_drives_cmd = %s", list_drives_cmd);
    24332411
     
    24712449    } else {
    24722450        // We need to look on each partition then
    2473         mr_asprintf(&list_drives_cmd,
    2474             "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2451        mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    24752452        log_it("list_drives_cmd = %s", list_drives_cmd);
    24762453
     
    25752552            log_msg(1, "curr_fname = %s", curr_fname);
    25762553            sprintf(command, "file %s", curr_fname);
    2577             mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2554            mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    25782555            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    25792556                 p--);
    25802557            p++;
    2581             mr_asprintf(&scratch, p);
     2558            mr_asprintf(&scratch, "%s", p);
    25822559            for (p = scratch; *p != '\0' && *p != '\''; p++);
    25832560            *p = '\0';
     
    26292606    log_msg(1, "Using %s", fdisk);
    26302607    sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    2631     mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2608    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    26322609    if (strstr(tmp, "GPT") == NULL) {
    26332610        strcpy(output, "MBR");
  • branches/2.2.9/mondo/src/common/libmondo-fifo.c

    r2217 r2290  
    166166    }
    167167    paranoid_system("sync");
    168     mr_asprintf(&command,
    169             "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
     168    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);
    170169    log_msg(2, "kill_buffer() --- command = %s", command);
    171     mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     170    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    172171    mr_free(command);
    173172
  • branches/2.2.9/mondo/src/common/libmondo-filelist.c

    r2241 r2290  
    14011401#if linux
    14021402        // 2.6 has /sys as a proc-type thing -- must be excluded
    1403         mr_asprintf(&strtmp,
    1404              "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",
    1405              dir, find_excludes, g_skeleton_filelist);
     1403        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);
    14061404#else
    14071405        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1408         mr_asprintf(&strtmp,
    1409              "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null",
    1410                 dir, find_excludes, g_skeleton_filelist);
     1406        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);
    14111407#endif
    14121408        paranoid_free(find_excludes);
     
    14981494                                counter = 0;
    14991495                                uberctr++;
    1500                                 mr_asprintf(&tmp, " %c ",
    1501                                         special_dot_char(uberctr));
     1496                                mr_asprintf(&tmp, " %c ", special_dot_char(uberctr));
    15021497#ifndef _XWIN
    15031498                                if (!g_text_mode) {
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.c

    r2237 r2290  
    532532            (drivelist->el[i].device,
    533533             DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) {
    534             mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)",
    535                     drivelist->el[i].device);
     534            mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
    536535            log_it(tmp);
    537536            paranoid_free(tmp);
     
    622621        if (copies > 1 && last_copy == currline
    623622            && strcmp(curr_mountpoint, "raid")) {
    624             mr_asprintf(&tmp, " %s %s's.", number_to_text(copies),
    625                     curr_mountpoint);
     623            mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
    626624            mr_strcat(flaws_str, "%s", tmp);
    627625            log_it(tmp);
     
    749747                       (void *) &mountlist->el[i],
    750748                       sizeof(struct mountlist_line));
    751                 mr_asprintf(&tmp,
    752                          "%s is available; user may choose to add it to raid device",
    753                          output_list->el[items - 1].device);
     749                mr_asprintf(&tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
    754750                log_it(tmp);
    755751                paranoid_free(tmp);
     
    869865            if (j < items) {
    870866                strcat(mountlist->el[items].device, "_dup");
    871                 mr_asprintf(&tmp,
    872                          "Duplicate entry in mountlist - renaming to %s",
    873                          mountlist->el[items].device);
     867                mr_asprintf(&tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    874868                log_it(tmp);
    875869                paranoid_free(tmp);
  • branches/2.2.9/mondo/src/common/libmondo-tools.c

    r2241 r2290  
    684684                retval++;
    685685            } else {
    686                 mr_asprintf(&ip_address, inet_ntoa
    687                        ((struct in_addr)
    688                         *((struct in_addr *) hent->h_addr)));
     686                mr_asprintf(&ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    689687                mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':'));
    690688                strcpy(bkpinfo->nfs_mount, ip_address);
  • branches/2.2.9/mondo/src/common/newt-specific.c

    r2241 r2290  
    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.9/mondo/src/lib/mr_conf.c

    r1594 r2290  
    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.9/mondo/src/mondoarchive/mondoarchive.c

    r2241 r2290  
    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.9/mondo/src/mondorestore/mondo-prep.c

    r2230 r2290  
    612612  // - faulty devices ignored
    613613  // - persistent superblock always used as this is recommended
    614   mr_asprintf(&program,
    615        "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d",
    616        raidlist->el[i].raid_device, level,
    617        raidlist->el[i].data_disks.entries);
     614  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);
    618615  if (raidlist->el[i].parity != -1) {
    619616    mr_asprintf(&strtmp, "%s", program);
     
    710707#endif
    711708    if (strlen(format) <= 2) {
    712         mr_asprintf(&tmp,
    713                 "%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",
    714                 device, format);
     709        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);
    715710        log_it(tmp);
    716711        paranoid_free(tmp);
     
    777772
    778773                while (1) {
    779                     mr_asprintf(&tmp,
    780                             "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'",
    781                             line);
     774                    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);
    782775                    FILE *pin = popen(tmp, "r");
    783776                    paranoid_free(tmp);
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-compare.c

    r2242 r2290  
    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.9/mondo/src/mondorestore/mondorestore.c

    r2242 r2290  
    17831783//      if (strstr(tarball_fname, ".star."))
    17841784        if (use_star) {
    1785             mr_asprintf(&command,
    1786                     "star -x -force-remove -U " STAR_ACL_SZ
    1787                     " errctl= file=%s", tarball_fname);
     1785            mr_asprintf(&command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
    17881786            if (strstr(tarball_fname, ".bz2")) {
    17891787                mr_strcat(command, " -bz");
     
    17911789        } else {
    17921790            if (filelist_subset_fname[0] != '\0') {
    1793                 mr_asprintf(&command,
    1794                         "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s",
    1795                         TAPE_BLOCK_SIZE,
    1796                         BUFSIZE, executable, filelist_subset_fname,
    1797 //             files_to_restore_this_time_fname,
    1798                         tarball_fname);
     1791                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);
    17991792            } else {
    1800                 mr_asprintf(&command,
    1801                         "afio -i -b %ld -c %ld -M 8m %s %s",
    1802                         TAPE_BLOCK_SIZE,
    1803                         BUFSIZE, executable, tarball_fname);
     1793                mr_asprintf(&command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
    18041794            }
    18051795        }
Note: See TracChangeset for help on using the changeset viewer.