Ignore:
Timestamp:
Aug 18, 2009, 3:19:54 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3337@localhost: bruno | 2009-08-11 20:02:18 +0200
bkpinfo->boot_device and bkpinfo->zip_exe are now dynamically allocated

File:
1 edited

Legend:

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

    r2325 r2326  
    204204 * - @c restore_path
    205205 * - @c use_lzo
    206  * - @c zip_exe
    207206 * - @c zip_suffix
    208207 * @param mtpt The mountpoint the CD/DVD/ISO is mounted on.
     
    432431    mr_asprintf(outlog, "%s/afio.log", bkpinfo->tmpdir);
    433432    /* if programmer forgot to say which compression thingy to use then find out */
    434     if (strstr(tarball_fname, ".lzo")
    435         && strcmp(bkpinfo->zip_suffix, "lzo")) {
     433    if (strstr(tarball_fname, ".lzo") && strcmp(bkpinfo->zip_suffix, "lzo")) {
    436434        log_msg(2, "OK, I'm going to start using lzop.");
    437         strcpy(bkpinfo->zip_exe, "lzop");
     435        mr_free(bkpinfo->zip_exe);
     436        mr_asprintf(bkpinfo->zip_exe, "lzop");
    438437        strcpy(bkpinfo->zip_suffix, "lzo");
    439438        bkpinfo->use_lzo = TRUE;
    440439        bkpinfo->use_gzip = FALSE;
    441440    }
    442     if (strstr(tarball_fname, ".gz")
    443         && strcmp(bkpinfo->zip_suffix, "gz")) {
     441    if (strstr(tarball_fname, ".gz") && strcmp(bkpinfo->zip_suffix, "gz")) {
    444442        log_msg(2, "OK, I'm going to start using gzip.");
    445         strcpy(bkpinfo->zip_exe, "gzip");
     443        mr_free(bkpinfo->zip_exe);
     444        mr_asprintf(bkpinfo->zip_exe, "gzip");
    446445        strcpy(bkpinfo->zip_suffix, "gz");
    447446        bkpinfo->use_lzo = FALSE;
    448447        bkpinfo->use_gzip = TRUE;
    449448    }
    450     if (strstr(tarball_fname, ".bz2")
    451         && strcmp(bkpinfo->zip_suffix, "bz2")) {
     449    if (strstr(tarball_fname, ".bz2") && strcmp(bkpinfo->zip_suffix, "bz2")) {
    452450        log_msg(2, "OK, I'm going to start using bzip2.");
    453         strcpy(bkpinfo->zip_exe, "bzip2");
     451        mr_free(bkpinfo->zip_exe);
     452        mr_asprintf(bkpinfo->zip_exe, "bzip2");
    454453        strcpy(bkpinfo->zip_suffix, "bz2");
    455454        bkpinfo->use_lzo = FALSE;
     
    463462    } else {
    464463        bkpinfo->use_star = FALSE;
    465         mr_asprintf(command, "afio -r -P %s -Z %s >> %s 2>> %s", bkpinfo->zip_exe, tarball_fname, outlog, outlog);
     464        /* Here we suppose that there is always a compression program called */
     465        if (bkpinfo->zip_exe) {
     466            mr_asprintf(command, "afio -r -P %s -Z %s >> %s 2>> %s", bkpinfo->zip_exe, tarball_fname, outlog, outlog);
     467        } else {
     468            mr_asprintf(command, "afio -r -Z %s >> %s 2>> %s", tarball_fname, outlog, outlog);
     469        }
    466470    }
    467471    log_msg(6, "command=%s", command);
Note: See TracChangeset for help on using the changeset viewer.