Changeset 2304 in MondoRescue


Ignore:
Timestamp:
Jul 27, 2009, 7:45:10 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • popup_and_get_string needs an allocated buffer for the moment so fixing the calls with dyn. ones
  • Fix a bug in mem.c for mr_strcat, which wasn't modifying the right pointer level
Location:
branches/2.2.9/mondo/src
Files:
3 edited

Legend:

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

    r2290 r2304  
    14681468{
    14691469    char *tmp = NULL;
     1470    char *tmp1 = NULL;
    14701471    char *mds = NULL;
    14711472    char *sz_size;
     
    14801481    malloc_string(comment);
    14811482    malloc_string(prompt);
     1483    malloc_string(tmp1);
    14821484    assert(bkpinfo != NULL);
    14831485    sz_size[0] = '\0';
     
    15371539            if (bkpinfo->backup_media_type == dvd) {
    15381540                find_dvd_device(bkpinfo->media_device, FALSE);
    1539                 mr_asprintf(&tmp, "1");
     1541                strcpy(tmp1, "1");
    15401542                sprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE);  // 4.7 salesman's GB = 4.482 real GB = 4482 MB
    15411543                log_msg(1, "Setting to DVD defaults");
    15421544            } else {
    15431545                strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM);
    1544                 mr_asprintf(&tmp, "4");
     1546                strcpy(tmp1, "4");
    15451547                strcpy(sz_size, "650");
    15461548                log_msg(1, "Setting to CD defaults");
    15471549            }
    15481550            if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) {
    1549                 if (!popup_and_get_string("Speed", comment, tmp, 4)) {
     1551                if (!popup_and_get_string("Speed", comment, tmp1, 4)) {
    15501552                    log_to_screen("User has chosen not to backup the PC");
    15511553                    finish(1);
    15521554                }
    15531555            }
    1554             bkpinfo->cdrw_speed = atoi(tmp);    // if DVD then this shouldn't ever be used anyway :)
    1555             mr_free(tmp);
     1556            bkpinfo->cdrw_speed = atoi(tmp1);   // if DVD then this shouldn't ever be used anyway :)
    15561557
    15571558            sprintf(comment,
     
    18141815            finish(1);
    18151816        }
    1816         mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir);
     1817        strcpy(tmp1, bkpinfo->nfs_remote_dir);
    18171818        if (!popup_and_get_string
    1818             ("Directory", "Which directory within that mountpoint?", tmp,
     1819            ("Directory", "Which directory within that mountpoint?", tmp1,
    18191820             MAX_STR_LEN)) {
    18201821            log_to_screen("User has chosen not to backup the PC");
    18211822            finish(1);
    18221823        }
    1823         strcpy(bkpinfo->nfs_remote_dir, tmp);
    1824         mr_free(tmp);
     1824        strcpy(bkpinfo->nfs_remote_dir, tmp1);
    18251825
    18261826        // check whether writable - we better remove surrounding spaces for this
     
    19661966        mr_free(tmp);
    19671967// NTFS
    1968         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    1969         if (strlen(tmp) > 2) {
     1968        strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1969        if (strlen(tmp1) > 2) {
    19701970            if (!popup_and_get_string
    19711971                ("NTFS partitions",
    19721972                 "Please enter/confirm the NTFS partitions you wish to backup as well.",
    1973                  tmp, MAX_STR_LEN / 4)) {
     1973                 tmp1, MAX_STR_LEN / 4)) {
    19741974                log_to_screen("User has chosen not to backup the PC");
    19751975                finish(1);
    19761976            }
    1977             strncpy(bkpinfo->image_devs, tmp, MAX_STR_LEN / 4);
    1978         }
    1979         mr_free(tmp);
     1977            strncpy(bkpinfo->image_devs, tmp1, MAX_STR_LEN / 4);
     1978        }
    19801979
    19811980
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.c

    r2290 r2304  
    537537        } else {
    538538            log_msg(8, "Evaluating drive #%d (%s) within mountlist", i, drivelist->el[i].device);
    539             if ((tmp = evaluate_drive_within_mountlist(mountlist, drivelist->el[i].device)) == NULL) {
     539            tmp = evaluate_drive_within_mountlist(mountlist, drivelist->el[i].device);
     540            if (tmp == NULL) {
    540541                res++;
    541542            }
    542543        }
    543544        log_msg(8,"Entry: %d (%s)", i, drivelist->el[i].device);
    544         /* BCO: tmp can be NULL as well as flaws_str */
     545        /* BCO: tmp can be NULL */
    545546        if (tmp != NULL) {
    546547            log_msg(8,"Adding: %s to %s", tmp, flaws_str);
  • branches/2.2.9/mondo/src/lib/mr_mem.c

    r2241 r2304  
    141141        mr_free_int((void **)&fmt2,line,file);
    142142        mr_free_int((void **)in,line,file);
    143         *in = p;
     143        in = &p;
    144144    }
    145145    va_end(args);
Note: See TracChangeset for help on using the changeset viewer.