Changeset 2306


Ignore:
Timestamp:
Jul 27, 2009, 7:50:18 PM (10 years ago)
Author:
bruno
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

Ported from 2.2.9

Location:
branches/2.2.10/mondo/src
Files:
3 edited

Legend:

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

    r2303 r2306  
    14451445{
    14461446    char *tmp = NULL;
     1447    char *tmp1 = NULL;
    14471448    char *mds = NULL;
    14481449    char *sz_size = NULL;
     
    14551456    malloc_string(prompt);
    14561457    malloc_string(sz_size);
     1458    malloc_string(tmp1);
    14571459    assert(bkpinfo != NULL);
    14581460    bkpinfo->nonbootable_backup = FALSE;
     
    15111513            if (bkpinfo->backup_media_type == dvd) {
    15121514                find_dvd_device(bkpinfo->media_device, FALSE);
    1513                 mr_asprintf(&tmp, "1");
     1515                strcpy(tmp1, "1");
    15141516                sprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE);  // 4.7 salesman's GB = 4.482 real GB = 4482 MB
    15151517                log_msg(1, "Setting to DVD defaults");
    15161518            } else {
    15171519                strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM);
    1518                 mr_asprintf(&tmp, "4");
     1520                strcpy(tmp1, "4");
    15191521                sprintf(sz_size, "%d", 650);
    15201522                log_msg(1, "Setting to CD defaults");
    15211523            }
    15221524            if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) {
    1523                 if (!popup_and_get_string("Speed", comment, tmp, 4)) {
     1525                if (!popup_and_get_string("Speed", comment, tmp1, 4)) {
    15241526                    log_to_screen("User has chosen not to backup the PC");
    15251527                    mr_free(comment);
     
    15291531            mr_free(comment);
    15301532
    1531             bkpinfo->cdrw_speed = atoi(tmp);    // if DVD then this shouldn't ever be used anyway :)
    1532             mr_free(tmp);
     1533            bkpinfo->cdrw_speed = atoi(tmp1);   // if DVD then this shouldn't ever be used anyway :)
    15331534
    15341535            mr_asprintf(&comment, "How much data (in Megabytes) will each %s store?", mds);
     
    17941795            finish(1);
    17951796        }
    1796         mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir);
     1797        strcpy(tmp1, bkpinfo->nfs_remote_dir);
    17971798        if (!popup_and_get_string
    1798             ("Directory", "Which directory within that mountpoint?", tmp,
     1799            ("Directory", "Which directory within that mountpoint?", tmp1,
    17991800             MAX_STR_LEN)) {
    18001801            log_to_screen("User has chosen not to backup the PC");
    18011802            finish(1);
    18021803        }
    1803         strcpy(bkpinfo->nfs_remote_dir, tmp);
    1804         mr_free(tmp);
     1804        strcpy(bkpinfo->nfs_remote_dir, tmp1);
    18051805
    18061806        // check whether writable - we better remove surrounding spaces for this
     
    19461946        mr_free(tmp);
    19471947// NTFS
    1948         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};'"));
    1949         if (strlen(tmp) > 2) {
     1948        strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1949        if (strlen(tmp1) > 2) {
    19501950            if (!popup_and_get_string
    19511951                ("NTFS partitions",
    19521952                 "Please enter/confirm the NTFS partitions you wish to backup as well.",
    1953                  tmp, MAX_STR_LEN / 4)) {
     1953                 tmp1, MAX_STR_LEN / 4)) {
    19541954                log_to_screen("User has chosen not to backup the PC");
    19551955                finish(1);
    19561956            }
    1957             strncpy(bkpinfo->image_devs, tmp, MAX_STR_LEN / 4);
    1958         }
    1959         mr_free(tmp);
     1957            strncpy(bkpinfo->image_devs, tmp1, MAX_STR_LEN / 4);
     1958        }
    19601959
    19611960
     
    20492048    }
    20502049    paranoid_free(sz_size);
     2050    paranoid_free(tmp1);
    20512051    paranoid_free(prompt);
    20522052    return (0);
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2291 r2306  
    559559        } else {
    560560            log_msg(8, "Evaluating drive #%d (%s) within mountlist", i, drivelist->el[i].device);
    561             if ((tmp = evaluate_drive_within_mountlist(mountlist, drivelist->el[i].device)) == NULL) {
     561            tmp = evaluate_drive_within_mountlist(mountlist, drivelist->el[i].device);
     562            if (tmp == NULL) {
    562563                res++;
    563564            }
    564565        }
    565566        log_msg(8,"Entry: %d (%s)", i, drivelist->el[i].device);
    566         /* BCO: tmp can be NULL as well as flaws_str */
     567        /* BCO: tmp can be NULL */
    567568        if (tmp != NULL) {
    568569            log_msg(8,"Adding: %s to %s", tmp, flaws_str);
  • branches/2.2.10/mondo/src/lib/mr_mem.c

    r2241 r2306  
    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.