Ignore:
Timestamp:
Jul 23, 2009, 2:53:30 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Replace sprintf by mr_asprintf in mondo-rstr-compare.c
  • All mr_asprintf call should be on one line (for quality script) and use a string as second param
  • Improve quality script
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2287 r2296  
    368368        log_msg(3, "Mommm! SME is being a dildo!");
    369369    } else {
    370         mr_asprintf(&mountpoint, mpt);
     370        mr_asprintf(&mountpoint, "%s", mpt);
    371371    }
    372372
     
    408408        mr_free(command);
    409409
    410         mr_asprintf(&command, "mount -t %s %s %s %s 2>> %s", format, device,
    411                 additional_parameters, mountdir, MONDO_LOGFILE);
     410        mr_asprintf(&command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE);
    412411        log_msg(2, "command='%s'", command);
    413412    }
     
    418417        log_msg(1, "Re-trying without the fancy extra parameters");
    419418        mr_free(command);
    420         mr_asprintf(&command, "mount -t %s %s %s 2>> %s", format, device,
    421             mountdir, MONDO_LOGFILE);
     419        mr_asprintf(&command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE);
    422420        res = run_program_and_log_output(command, TRUE);
    423421    }
     
    497495                "Again with the /proc - why is this in your mountlist?");
    498496        } else if (is_this_device_mounted(mountlist->el[lino].device)) {
    499             mr_asprintf(&tmp, "%s is already mounted",
    500                 mountlist->el[lino].device);
     497            mr_asprintf(&tmp, "%s is already mounted", mountlist->el[lino].device);
    501498            log_to_screen(tmp);
    502499            mr_free(tmp);
     
    607604        mr_asprintf(&mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
    608605#else
    609         mr_asprintf(&mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir,
    610             bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     606        mr_asprintf(&mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    611607#endif
    612608
     
    619615        mr_asprintf(&mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);
    620616#else
    621         mr_asprintf(&mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s",
    622             bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     617        mr_asprintf(&mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    623618#endif
    624619    } else if (bkpinfo->backup_media_type == usb) {
     
    11011096    unlink(FILELIST_FULL_STUB);
    11021097    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    1103         mr_asprintf(&command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s",
    1104             bkpinfo->internal_tape_block_size,
    1105             bkpinfo->media_device,
    1106             MOUNTLIST_FNAME_STUB,
    1107             BIGGIELIST_TXT_STUB,
    1108             FILELIST_FULL_STUB,
    1109             IWANTMYLVM_STUB,
    1110             MONDO_CFG_FILE_STUB);
     1098        mr_asprintf(&command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11111099        log_msg(1, "tarcommand = %s", command);
    11121100        run_program_and_log_output(command, 1);
     
    11161104            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    11171105            log_msg(2, "pre-2.2.4 compatible mode on");
    1118             mr_asprintf(&command,
    1119                 "tar -b %ld -zxf %s %s %s %s %s %s",
    1120                 bkpinfo->internal_tape_block_size,
    1121                 bkpinfo->media_device,
    1122                 MOUNTLIST_FNAME_STUB,
    1123                 BIGGIELIST_TXT_STUB,
    1124                 FILELIST_FULL_STUB,
    1125                 IWANTMYLVM_STUB,
    1126                 MONDO_CFG_FILE_STUB);
     1106            mr_asprintf(&command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11271107            log_msg(1, "tarcommand = %s", command);
    11281108            run_program_and_log_output(command, 1);
     
    11361116        log_msg(2, "Back from iotcn");
    11371117        run_program_and_log_output("mount", 1);
    1138         mr_asprintf(&command,
    1139             "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s",
    1140             MNT_CDROM,
    1141             MOUNTLIST_FNAME_STUB,
    1142             BIGGIELIST_TXT_STUB,
    1143             FILELIST_FULL_STUB,
    1144             IWANTMYLVM_STUB,
    1145             MONDO_CFG_FILE_STUB);
     1118        mr_asprintf(&command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11461119
    11471120        log_msg(1, "tarcommand = %s", command);
     
    11521125            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    11531126            log_msg(2, "pre-2.2.4 compatible mode on");
    1154             mr_asprintf(&command,
    1155                 "tar -zxf %s/images/all.tar.gz %s %s %s %s %s",
    1156                 MNT_CDROM,
    1157                 MOUNTLIST_FNAME_STUB,
    1158                 BIGGIELIST_TXT_STUB,
    1159                 FILELIST_FULL_STUB,
    1160                 IWANTMYLVM_STUB,
    1161                 MONDO_CFG_FILE_STUB);
     1127            mr_asprintf(&command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11621128
    11631129            log_msg(1, "tarcommand = %s", command);
     
    11951161    &&
    11961162    ask_me_yes_or_no("Do you want to retrieve the mountlist as well?")) {
    1197         mr_asprintf(&command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB,
    1198             bkpinfo->tmpdir);
     1163        mr_asprintf(&command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir);
    11991164        paranoid_system(command);
    12001165        mr_free(command);
     
    12251190            mr_free(command);
    12261191        }
    1227         mr_asprintf(&command, "grep -E '^/dev/.*' %s > %s",
    1228                 g_biggielist_txt, g_filelist_imagedevs);
     1192        mr_asprintf(&command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs);
    12291193        paranoid_system(command);
    12301194        mr_free(command);
     
    20442008                            "Well, I know a certain kitty-kitty who'll be sleeping with Mommy tonight...");
    20452009                } else {
    2046                     mr_asprintf(&command, "umount " MNT_RESTORING "%s",
    2047                             mountlist->el[lino].mountpoint);
     2010                    mr_asprintf(&command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);
    20482011
    20492012                    /* To support latest Ubuntu where /var is a separate FS
     
    21122075    }
    21132076
    2114     mr_asprintf(&command,
    2115             "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s",
    2116             dev,
    2117             bkpinfo->internal_tape_block_size,
    2118             1024L * 1024 * 32 / bkpinfo->internal_tape_block_size,
    2119             MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB,
    2120             BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
     2077    mr_asprintf(&command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
    21212078    log_msg(2, "command = '%s'", command);
    21222079    res = run_program_and_log_output(command, -1);
     
    21292086            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    21302087            log_msg(2, "pre-2.2.4 compatible mode on");
    2131             mr_asprintf(&command,
    2132                     "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s",
    2133                     dev,
    2134                     bkpinfo->internal_tape_block_size,
    2135                     1024L * 1024 * 32 / bkpinfo->internal_tape_block_size,
    2136                     MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB,
    2137                     BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
     2088            mr_asprintf(&command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
    21382089            log_msg(2, "command = '%s'", command);
    21392090            res = run_program_and_log_output(command, -1);
     
    22262177                log_msg(2, "media_device is blank; assuming %s");
    22272178            }
    2228             mr_asprintf(&tmp, bkpinfo->media_device);
     2179            mr_asprintf(&tmp, "%s", bkpinfo->media_device);
    22292180            if (extract_cfg_file_and_mountlist_from_tape_dev
    22302181                (bkpinfo->media_device)) {
     
    23352286            /* Is this code really useful ??? */
    23362287        if (extract_mountlist_stub) {
    2337             mr_asprintf(&command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB,
    2338                     bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);
     2288            mr_asprintf(&command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);
    23392289            run_program_and_log_output(command, FALSE);
    23402290            mr_free(command);
Note: See TracChangeset for help on using the changeset viewer.