Changeset 3291 in MondoRescue for branches/3.2


Ignore:
Timestamp:
May 27, 2014, 5:53:12 PM (10 years ago)
Author:
Bruno Cornec
Message:
  • good_format string is now dynamically allocated
File:
1 edited

Legend:

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

    r3288 r3291  
    10151015    char *command = NULL;
    10161016    char *format_sz = NULL;
    1017     char *p;
     1017    char *p = NULL;
    10181018
    10191019    FILE *pin;
    10201020    int retval;
    1021     malloc_string(good_formats);
    10221021
    10231022    assert_string_is_neither_NULL_nor_zerolength(format);
     
    10381037        retval = 0;
    10391038    } else {
    1040         strcpy(good_formats, " ");
    1041         p = fgets(good_formats + 1, MAX_STR_LEN - 1, pin);
    1042         if (pclose(pin) && (p != NULL)) {
    1043             log_OS_error("Cannot pclose good formats");
    1044         }
    1045         strip_spaces(good_formats);
    1046         strcat(good_formats, " swap lvm raid ntfs-3g ntfs 7 "); // " ntfs 7 " -- um, cheating much? :)
     1039        mr_getline(p, pin);
     1040        mr_asprintf(good_formats, " %s",p);
     1041        (void)pclose(pin);
     1042        mr_strip_spaces(good_formats);
     1043        mr_strcat(good_formats, " swap lvm raid ntfs-3g ntfs 7 ");  // " ntfs 7 " -- um, cheating much? :)
    10471044        if (strstr(good_formats, format_sz)) {
    10481045            retval = 1;
     
    10511048        }
    10521049    }
    1053     paranoid_free(good_formats);
     1050    mr_free(good_formats);
    10541051    mr_free(format_sz);
    10551052
Note: See TracChangeset for help on using the changeset viewer.