Ignore:
Timestamp:
Mar 5, 2024, 2:50:53 AM (4 months ago)
Author:
Bruno Cornec
Message:

manages isodir dynamically

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3835 r3836  
    13541354        log_msg(2, "Mounting for Network thingy");
    13551355        log_msg(2, "isodir = %s", bkpinfo->isodir);
    1356         if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/")) && am_I_in_disaster_recovery_mode()) {
    1357             strcpy(bkpinfo->isodir, "/tmp/isodir");
     1356        if ((bkpinfo->isodir == NULL) || !strcmp(bkpinfo->isodir, "/"))) && am_I_in_disaster_recovery_mode()) {
     1357            mr_asprintf(bkpinfo->isodir, "%s", "/tmp/isodir");
    13581358            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    13591359        }
     
    24992499            }
    25002500            mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", tmp1);
    2501             tmp = call_program_and_get_last_line_of_output(command);
    2502             strcpy(bkpinfo->isodir, tmp);
    2503             mr_free(tmp);
     2501            mr_free(bkpinfo->isodir);
     2502            bkpinfo->isodir = call_program_and_get_last_line_of_output(command);
    25042503            mr_free(command);
    25052504
     
    25662565        log_msg(3, "Testing mount for %s", bkpinfo->netfs_mount);
    25672566        if (is_this_device_mounted(bkpinfo->netfs_mount)) {
    2568             tmp = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1");
    2569             strcpy(bkpinfo->isodir, tmp);
    2570             mr_free(tmp);
     2567            mr_free(bkpinfo->isodir);
     2568            bkpinfo->isodir = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1");
    25712569        } else {
    25722570            // Why netfsdir ?
    2573             snprintf(bkpinfo->isodir, (MAX_STR_LEN / 4) -1, "%s/netfsdir", bkpinfo->tmpdir);
     2571            mr_asprintf(bkpinfo->isodir, "%s/netfsdir", bkpinfo->tmpdir);
    25742572            mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir);
    25752573            run_program_and_log_output(command, 5);
     
    26392637    case iso:
    26402638        if (!bkpinfo->disaster_recovery) {
    2641             if (!popup_and_get_string("Storage dir.", "Please enter the full path name to the directory for your ISO images.  Example: /mnt/raid0_0", bkpinfo->isodir,(MAX_STR_LEN / 4)-1)) {
     2639            tmp = mr_popup_and_get_string("Storage dir.", "Please enter the full path name to the directory for your ISO images.  Example: /mnt/raid0_0", bkpinfo->isodir);
     2640            if (tmp == NULL) {
    26422641                log_to_screen("User has chosen not to backup the machine");
    26432642                finish(1);
     2643            } else {
     2644                mr_free(bkpinfo->isodir);
     2645                bkpinfo->isodir = tmp;
    26442646            }
    26452647            if (archiving_to_media) {
Note: See TracChangeset for help on using the changeset viewer.