Ignore:
Timestamp:
Mar 7, 2024, 1:33:54 AM (3 months ago)
Author:
Bruno Cornec
Message:

Fix build_partition_name to allocate dynamically and change proto accordingly

File:
1 edited

Legend:

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

    r3857 r3859  
    356356    assert(partno >= 0 && partno < 999);
    357357
    358     malloc_string(searchstr);
    359 
    360358#ifdef __FreeBSD__
    361359    // We assume here that this is running from mondorestore. (It is.)
    362     mr_asprintf(program, "ls %s %s >/dev/null 2>&1", drive, build_partition_name(tmp, drive, partno));
     360    tmp = build_partition_name(drive, partno);
     361    mr_asprintf(program, "ls %s %s >/dev/null 2>&1", drive, tmp);
     362    mr_free(tmp);
    363363    res = system(program);
    364364    mr_free(program);
     
    376376    mr_free(program);
    377377
    378     (void) build_partition_name(searchstr, drive, partno);
    379     strcat(searchstr, " ");
     378    searchstr = build_partition_name(drive, partno);
     379    mr_strcat(searchstr, " ");
    380380    for (res = 0, mr_getline(incoming, fin); !res && !feof(fin) ; mr_getline(incoming, fin)) {
    381381        if (strstr(incoming, searchstr)) {
     
    384384        mr_free(incoming);
    385385    }
     386    mr_free(searchstr);
    386387    mr_free(incoming);
    387388
     
    389390        log_OS_error("Cannot pclose fin");
    390391    }
    391     paranoid_free(searchstr);
    392392    return (res);
    393393}
Note: See TracChangeset for help on using the changeset viewer.