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/common/libmondo-tools.c

    r2291 r2296  
    610610
    611611        log_it("isodir = %s", bkpinfo->isodir);
    612         mr_asprintf(&command, "df -P %s | tail -n1 | cut -d' ' -f1",
    613                 bkpinfo->isodir);
     612        mr_asprintf(&command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir);
    614613        log_it("command = %s", command);
    615614        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
     
    911910            ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
    912911    }
    913     mr_asprintf(&tmp, "%s",
    914            call_program_and_get_last_line_of_output
    915            ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     912    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
    916913    if (atol(tmp) < 35000) {
    917914        retval++;
     
    984981    run_program_and_log_output
    985982        ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    986     mr_asprintf(&tmp, "%s",
    987            call_program_and_get_last_line_of_output
    988            ("mount | grep -E \"cdr(om|w)\""));
     983    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));
    989984    if (strcmp("", tmp)) {
    990985        if (strstr(tmp, "autofs")) {
     
    10671062    assert_string_is_neither_NULL_nor_zerolength(label);
    10681063    if (!does_file_exist(config_file)) {
    1069         mr_asprintf(&tmp, "(read_cfg_var) Cannot find %s config file",
    1070                 config_file);
     1064        mr_asprintf(&tmp, "(read_cfg_var) Cannot find %s config file", config_file);
    10711065        log_to_screen(tmp);
    10721066        mr_free(tmp);
     
    10781072        return (0);
    10791073    } else {
    1080         mr_asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5",
    1081                 label, config_file);
     1074        mr_asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
    10821075        strcpy(value, call_program_and_get_last_line_of_output(command));
    10831076        mr_free(command);
     
    12071200    g_boot_mountpt[0] = '\0';
    12081201    log_msg(4, "Done. Great. Seeting command to something");
    1209     mr_asprintf(&command, "%s",
    1210            "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[   ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
     1202    mr_asprintf(&command, "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[    ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
    12111203    log_msg(4, "Cool. Command = '%s'", command);
    12121204    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    12181210        mr_asprintf(&command, "mount | grep -Ew '/boot'");
    12191211        mr_free(tmp);
    1220         mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     1212        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    12211213        mr_free(command);
    12221214
     
    12351227                    strcpy(g_boot_mountpt, tmp);
    12361228                    mr_free(tmp);
    1237                     mr_asprintf(&tmp,
    1238                             "%s (your /boot partition) is not mounted. I'll mount it before backing up",
    1239                             g_boot_mountpt);
     1229                    mr_asprintf(&tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
    12401230                    log_it(tmp);
    12411231                    mr_free(tmp);
     
    13041294    assert(value != NULL);
    13051295    if (!does_file_exist(config_file)) {
    1306         mr_asprintf(&tmp, "(write_cfg_file) Cannot find %s config file",
    1307                 config_file);
     1296        mr_asprintf(&tmp, "(write_cfg_file) Cannot find %s config file", config_file);
    13081297        log_to_screen(tmp);
    13091298        mr_free(tmp);
     
    13121301    mr_asprintf(&tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
    13131302    if (does_file_exist(config_file)) {
    1314         mr_asprintf(&command, "grep -vE '^%s .*$' %s > %s",
    1315                 label, config_file, tempfile);
     1303        mr_asprintf(&command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile);
    13161304        paranoid_system(command);
    13171305        mr_free(command);
Note: See TracChangeset for help on using the changeset viewer.