Changeset 2932 in MondoRescue


Ignore:
Timestamp:
Jan 24, 2012, 2:45:39 PM (12 years ago)
Author:
Bruno Cornec
Message:
  • Fix #577 by having factor back as a float (not a long ! it's a decimal value) and making the appropriate cast.
File:
1 edited

Legend:

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

    r2928 r2932  
    24882488
    24892489    /** float ***********************************************************/
    2490     long long factor;
     2490    float factor;
    24912491    long long new_size;
    24922492
     
    25232523
    25242524    drivemntlist = malloc(sizeof(struct mountlist_reference));
    2525     drivemntlist->el =
    2526         malloc(sizeof(struct mountlist_line *) * MAX_MOUNTLIST_ENTRIES);
     2525    drivemntlist->el = malloc(sizeof(struct mountlist_line *) * MAX_MOUNTLIST_ENTRIES);
    25272526
    25282527    if (!drivemntlist) {
     
    25382537    }
    25392538
    2540     if (original_size_of_drive <= 0) {
     2539    if (original_size_of_drive <= 0LL) {
    25412540        mr_asprintf(&tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
    25422541        log_to_screen(tmp);
     
    25442543        return;
    25452544    }
    2546     factor = (current_size_of_drive) / (original_size_of_drive);
    2547     mr_asprintf(&tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %lld)",
     2545    factor = ((float)current_size_of_drive/(float)original_size_of_drive);
     2546    mr_asprintf(&tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)",
    25482547            drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor);
    25492548    log_to_screen(tmp);
     
    25542553        /* the 'atoi' thing is to make sure we don't try to resize _images_, whose formats will be numeric */
    25552554        if (!atoi(drivemntlist->el[partno]->format)) {
    2556             new_size = (drivemntlist->el[partno]->size) * factor;
     2555            new_size = (long long)((drivemntlist->el[partno]->size) * factor);
    25572556        } else {
    25582557            new_size = drivemntlist->el[partno]->size;
Note: See TracChangeset for help on using the changeset viewer.