Ignore:
Timestamp:
Aug 18, 2009, 3:05:43 PM (11 years ago)
Author:
Bruno Cornec
Message:

r3334@localhost: bruno | 2009-08-08 12:17:37 +0200

  • Change mr_asprintf interface to pass only the char * (makes bkpinfo usage more easy)
File:
1 edited

Legend:

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

    r2316 r2323  
    125125
    126126    if (bkpinfo->nfs_user) {
    127         mr_asprintf(&tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
     127        mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
    128128    } else {
    129         mr_asprintf(&tmp1, "%s", basic_call);
    130     }
    131 
    132     mr_asprintf(&cd_number_str, "%d", cd_no);
     129        mr_asprintf(tmp1, "%s", basic_call);
     130    }
     131
     132    mr_asprintf(cd_number_str, "%d", cd_no);
    133133    log_msg(4, "basic call = '%s'", tmp1);
    134134    midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_");
     
    145145
    146146    log_msg(4, "ultimate call = '%s'", ultimate_call);
    147     mr_asprintf(&command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
     147    mr_asprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
    148148    mr_free(ultimate_call);
    149149
     
    153153            what_i_am_doing);
    154154    if (bkpinfo->manual_cd_tray) {
    155         mr_asprintf(&tmp2, "%s", command);
     155        mr_asprintf(tmp2, "%s", command);
    156156        p = strstr(tmp2, "2>>");
    157157        if (p) {
     
    272272        log_if_failure = TRUE;
    273273    }
    274     mr_asprintf(&callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
     274    mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
    275275    while ((p = strchr(callstr, '\r'))) {
    276276        *p = ' ';
     
    288288    mr_free(callstr);
    289289
    290     mr_asprintf(&callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
     290    mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
    291291    if (log_if_failure && system(callstr)) {
    292292        log_OS_error("Command failed");
     
    294294    mr_free(callstr);
    295295
    296     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
     296    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
    297297    unlink(tmp1);
    298298    mr_free(tmp1);
    299299
    300     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
     300    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
    301301    fin = fopen(tmp1, "r");
    302302    if (fin) {
     
    363363    assert_string_is_neither_NULL_nor_zerolength(basic_call);
    364364
    365     mr_asprintf(&lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
    366 
    367     mr_asprintf(&command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
     365    mr_asprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
     366
     367    mr_asprintf(command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
    368368    open_evalcall_form(what_i_am_doing);
    369     mr_asprintf(&tmp, "Executing %s", basic_call);
     369    mr_asprintf(tmp, "Executing %s", basic_call);
    370370    log_msg(2, tmp);
    371371    mr_free(tmp);
     
    373373    if (!(fin = popen(command, "r"))) {
    374374        log_OS_error("Unable to popen-in command");
    375         mr_asprintf(&tmp, "Failed utterly to call '%s'", command);
     375        mr_asprintf(tmp, "Failed utterly to call '%s'", command);
    376376        log_to_screen(tmp);
    377377        mr_free(tmp);
     
    463463        fin = f_orig;
    464464        fout = f_archived;
    465         mr_asprintf(&tmp, "%-64s", PIMP_START_SZ);
     465        mr_asprintf(tmp, "%-64s", PIMP_START_SZ);
    466466        if (fwrite(tmp, 1, 64, fout) != 64) {
    467467            mr_free(tmp);
     
    475475                break;
    476476            }
    477             mr_asprintf(&tmp, "%-64ld", bytes_read_in);
     477            mr_asprintf(tmp, "%-64ld", bytes_read_in);
    478478            if (fwrite(tmp, 1, 64, fout) != 64) {
    479479                mr_free(tmp);
     
    486486                    subsliceno, bytes_read_in, bytes_to_be_read);
    487487            bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
    488             mr_asprintf(&tmp, "%-64ld", subsliceno);
     488            mr_asprintf(tmp, "%-64ld", subsliceno);
    489489            if (fwrite(tmp, 1, 64, fout) != 64) {
    490490                mr_free(tmp);
     
    495495            subsliceno++;
    496496        }
    497         mr_asprintf(&tmp, "%-64ld", 0L);
     497        mr_asprintf(tmp, "%-64ld", 0L);
    498498        if (fwrite(tmp, 1, 64L, fout) != 64L) {
    499499            mr_free(tmp);
     
    502502        mr_free(tmp);
    503503
    504         mr_asprintf(&tmp, "%-64s", PIMP_END_SZ);
     504        mr_asprintf(tmp, "%-64s", PIMP_END_SZ);
    505505        if (fwrite(tmp, 1, 64, fout) != 64) {
    506506            mr_free(tmp);
     
    559559            log_msg(5, "tmpB is %s", tmp1);
    560560            if (!strstr(tmp1, PIMP_END_SZ)) {
    561                 mr_asprintf(&filestr, "%s/out.leftover", bkpinfo->tmpdir);
     561                mr_asprintf(filestr, "%s/out.leftover", bkpinfo->tmpdir);
    562562                ftmp = fopen(filestr, "w");
    563563                mr_free(filestr);
     
    604604        fatal_error("ntfsclone not found");
    605605    }
    606     mr_asprintf(&command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
     606    mr_asprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
    607607    res = run_program_and_log_output(command, 5);
    608608    mr_free(command);
     
    659659    malloc_string(title);
    660660    strcpy(title, tt);
    661     mr_asprintf(&command, "%s 2>> %s", cmd, MONDO_LOGFILE);
     661    mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);
    662662    log_msg(3, "command = '%s'", command);
    663663    if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) {
     
    719719        fatal_error("ntfsclone not found");
    720720    }
    721     mr_asprintf(&command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
     721    mr_asprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
    722722    res = run_program_and_log_output(command, 5);
    723723    mr_free(command);
Note: See TracChangeset for help on using the changeset viewer.