Changeset 3835 in MondoRescue


Ignore:
Timestamp:
Mar 5, 2024, 2:06:28 AM (3 months ago)
Author:
Bruno Cornec
Message:

manages prefix dynamically

Location:
branches/3.3/mondo/src
Files:
4 edited

Legend:

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

    r3832 r3835  
    682682
    683683    if (flag_set['p']) {
    684         strncpy(bkpinfo->prefix, flag_val['p'],(MAX_STR_LEN / 4)-1);
     684        mr_asprintf(bkpinfo->prefix, "%s", flag_val['p']);
    685685        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    686686    }
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3834 r3835  
    26252625        bkpinfo->netfs_remote_dir = mr_strip_spaces(tmp1);
    26262626
    2627         if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix,(MAX_STR_LEN / 4)-1)) {
     2627        tmp = popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix);
     2628        if (tmp == NULL) {
    26282629            log_to_screen("User has chosen not to backup the machine");
    26292630            finish(1);
    26302631        }
     2632        mr_free(bkpinfo->prefix);
     2633        bkpinfo->prefix = tmp;
    26312634        log_msg(3, "prefix set to %s", bkpinfo->prefix);
    26322635        log_msg(3, "Just set netfs_remote_dir to %s", bkpinfo->netfs_remote_dir);
     
    26592662            }
    26602663        }
    2661         if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix,(MAX_STR_LEN / 4)-1)) {
     2664        tmp = popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix);
     2665        if (tmp == NULL) {
    26622666            log_to_screen("User has chosen not to backup the machine");
    26632667            finish(1);
    26642668        }
     2669        mr_free(bkpinfo->prefix);
     2670        bkpinfo->prefix = tmp;
    26652671        log_msg(3, "prefix set to %s", bkpinfo->prefix);
    26662672        break;
     
    28882894    log_it("media size = %ld", bkpinfo->media_size);
    28892895    log_it("media type = %s", bkptype_to_string(bkpinfo->backup_media_type));
    2890     if (bkpinfo->prefix) {
     2896    if (bkpinfo->prefix != NULL) {
    28912897        log_it("prefix = %s", bkpinfo->prefix);
    28922898    }
  • branches/3.3/mondo/src/common/newt-specific.c

    r3834 r3835  
    441441        mr_free(bkpinfo->tmpdir);
    442442        mr_free(bkpinfo->scratchdir);
     443        mr_free(bkpinfo->prefix);
    443444        /* Then free the structure */
    444445        paranoid_free(bkpinfo);
  • branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c

    r3833 r3835  
    687687        }
    688688        if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    689             strcpy(bkpinfo->prefix,value);
     689            mr_asprintf(bkpinfo->prefix, "%s", value);
    690690        } else {
    691             strcpy(bkpinfo->prefix,STD_PREFIX);
     691            mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
    692692        }
    693693        log_it("Setting Prefix to %s", bkpinfo->prefix);
     
    706706        }
    707707        if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    708                 strcpy(bkpinfo->prefix,value);
     708            mr_asprintf(bkpinfo->prefix, "%s", value);
    709709        } else {
    710                 strcpy(bkpinfo->prefix,STD_PREFIX);
     710            mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
    711711        }
    712712        tmp1 = call_program_and_get_last_line_of_output("cat "CMDLINE);
     
    718718                fatal_error("no imgname variable in environment");
    719719            }
    720             strcpy(bkpinfo->prefix,envtmp1);
     720            mr_asprintf(bkpinfo->prefix, "%s", envtmp1);
    721721        }   
    722722        mr_free(tmp1);
Note: See TracChangeset for help on using the changeset viewer.