Ignore:
Timestamp:
Sep 20, 2013, 2:29:57 PM (11 years ago)
Author:
Bruno Cornec
Message:

Simplify the interface of mr_getline and mr_asprintf. With 3.1 compatibility now will allow backports from this branch into 3.0

File:
1 edited

Legend:

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

    r3158 r3185  
    330330                if (HDD) {
    331331                    /*  We need an additional param */
    332                     mr_asprintf(&(bkpinfo->subdir), "%s", bkpinfo->isodir);
     332                    mr_asprintf(bkpinfo->subdir, "%s", bkpinfo->isodir);
    333333                    strcpy(bkpinfo->isodir, "/tmp/isodir");
    334334                    log_it("Now bkpinfo->isodir = %s and subdir = ", bkpinfo->isodir, bkpinfo->subdir);
     
    383383    log_to_screen("WARNING - isodir is already mounted");
    384384} else {
    385     mr_asprintf(&mount_isodir_command, "mount %s", g_isodir_device);
     385    mr_asprintf(mount_isodir_command, "mount %s", g_isodir_device);
    386386    if (strlen(g_isodir_format) > 1) {
    387387        mr_strcat(mount_isodir_command, " -t %s", g_isodir_format);
     
    478478    log_msg(1, tmp);
    479479    /* Deal with additional params only if not /proc or /sys */
    480     mr_asprintf(&additional_parameters, "");
     480    mr_asprintf(additional_parameters, "");
    481481    if (strcmp(format, "proc") && strcmp(format, "sys")) {
    482482        if (writeable) {
     
    586586               "", mountlist->entries);
    587587
    588     mr_asprintf(&these_failed, "");
     588    mr_asprintf(these_failed, "");
    589589    for (lino = 0; lino < mountlist->entries; lino++) {
    590590        if (!strcmp(mountlist->el[lino].device, "/proc")) {
     
    766766    bkpinfo->please_dont_eject = TRUE;
    767767    if (read_cfg_var(cfg_file, "netfs-proto", value) == 0) {
    768         mr_asprintf(&(bkpinfo->netfs_proto),"%s", value);
     768        mr_asprintf(bkpinfo->netfs_proto,"%s", value);
    769769    } else {
    770770        /* For compatibility, force protocol in old nfs case to be transparent */
    771         mr_asprintf(&(bkpinfo->netfs_proto), "nfs");
     771        mr_asprintf(bkpinfo->netfs_proto, "nfs");
    772772    }
    773773    if (read_cfg_var(cfg_file, "netfs-server-user", value) == 0) {
    774         mr_asprintf(&(bkpinfo->netfs_user),"%s", value);
     774        mr_asprintf(bkpinfo->netfs_user,"%s", value);
    775775    }
    776776    if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
     
    851851read_cfg_var(cfg_file, "acl", value);
    852852if (strstr(value, "TRUE")) {
    853     mr_asprintf(&g_getfacl,"setfacl");
     853    mr_asprintf(g_getfacl,"setfacl");
    854854    log_msg(1, "We will restore ACLs");
    855855    if (! find_home_of_exe("setfacl")) {
     
    859859read_cfg_var(cfg_file, "xattr", value);
    860860if (strstr(value, "TRUE")) {
    861     mr_asprintf(&g_getfattr,"setfattr");
     861    mr_asprintf(g_getfattr,"setfattr");
    862862    log_msg(1, "We will restore XATTRs");
    863863    if (! find_home_of_exe("setfattr")) {
     
    13701370     * the current /dev location
    13711371     */
    1372     mr_asprintf(&cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
     1372    mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
    13731373    run_program_and_log_output(cmd, 3);
    13741374    paranoid_free(cmd);
     
    13851385    read_cfg_var(g_mondo_cfg_file, "bootloader.device", device);
    13861386    read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
    1387     mr_asprintf(&tmp, "run_boot_loader: device='%s', name='%s'", device, name);
     1387    mr_asprintf(tmp, "run_boot_loader: device='%s', name='%s'", device, name);
    13881388    log_msg(2, tmp);
    13891389    paranoid_free(tmp);
     
    14021402#ifdef __FreeBSD__
    14031403    else if (!strcmp(name, "BOOT0")) {
    1404         mr_asprintf(&tmp, "boot0cfg -B %s", device);
     1404        mr_asprintf(tmp, "boot0cfg -B %s", device);
    14051405        res = run_program_and_log_output(tmp, FALSE);
    14061406        paranoid_free(tmp);
    14071407    } else {
    1408         mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
     1408        mr_asprintf(tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
    14091409        if (!system(tmp)) {
    14101410            paranoid_free(tmp);
    1411             mr_asprintf(&tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);
     1411            mr_asprintf(tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);
    14121412            res = run_program_and_log_output(tmp, 3);
    14131413        } else {
     
    20562056    paranoid_system("sync");
    20572057
    2058     mr_asprintf(&tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
     2058    mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
    20592059    if (run_program_and_log_output(tmp, FALSE)) {
    20602060        log_msg(1,
     
    20752075            continue;
    20762076        }
    2077         mr_asprintf(&tmp, "Unmounting device %s  ", mountlist->el[lino].device);
     2077        mr_asprintf(tmp, "Unmounting device %s  ", mountlist->el[lino].device);
    20782078
    20792079        update_progress_form(tmp);
Note: See TracChangeset for help on using the changeset viewer.