Changeset 3859 in MondoRescue for branches/3.3/mondo/src/mondorestore/mondo-prep.c
- Timestamp:
- Mar 7, 2024, 1:33:54 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/mondorestore/mondo-prep.c
r3741 r3859 1323 1323 1324 1324 /** buffers *********************************************************/ 1325 char *device_str ;1325 char *device_str = NULL; 1326 1326 char *format = NULL; 1327 1327 char *tmp = NULL; … … 1351 1351 #endif 1352 1352 1353 malloc_string(device_str);1354 1355 1353 for (current_devno = 1; current_devno < 99; current_devno++) { 1356 build_partition_name(device_str,drivename, current_devno);1354 device_str = build_partition_name(drivename, current_devno); 1357 1355 lino = find_device_in_mountlist(mountlist, device_str); 1358 1356 … … 1377 1375 drivename, 1378 1376 0); 1379 char command[MAX_STR_LEN]; 1380 sprintf(command, "disklabel -B %s", 1381 basename(drivename)); 1377 mr_asprintf(command, "disklabel -B %s", basename(drivename)); 1382 1378 if (system(command)) { 1383 1379 log_to_screen 1384 1380 ("Warning! Unable to make the drive bootable."); 1385 1381 } 1386 paranoid_free(device_str); 1382 mr_free(command); 1383 mr_free(device_str); 1387 1384 return r; 1388 1385 } 1389 1386 } 1390 1387 for (c = 'a'; c <= 'z'; c++) { 1391 mr_as sprintf(subdev_str, "%s%c", device_str, c);1388 mr_asprintf(subdev_str, "%s%c", device_str, c); 1392 1389 if (find_device_in_mountlist(mountlist, subdev_str) > 0) { 1393 1390 fbsd_part = TRUE; … … 1469 1466 if (current_devno == 5 && previous_devno == 4) { 1470 1467 log_to_screen("You must leave at least one partition spare as the Extended partition."); 1471 paranoid_free(device_str);1468 mr_free(device_str); 1472 1469 mr_free(format); 1473 1470 return (1); … … 1492 1489 1493 1490 previous_devno = current_devno; 1491 mr_free(device_str); 1494 1492 } 1495 1493 … … 1529 1527 } 1530 1528 } 1531 paranoid_free(device_str);1532 1529 return (retval); 1533 1530 } … … 1550 1547 /** buffers **********************************************************/ 1551 1548 char *program = NULL; 1552 char *partition_name ;1549 char *partition_name = NULL; 1553 1550 char *tmp = NULL; 1554 1551 char *output = NULL; … … 1570 1567 } 1571 1568 1572 malloc_string(partition_name); 1573 build_partition_name(partition_name, drive, partno); 1569 partition_name = build_partition_name(drive, partno); 1574 1570 if (partsize <= 0) { 1575 1571 mr_asprintf(tmp, "Partitioning device %s (max size)", partition_name); … … 1583 1579 if (is_this_device_mounted(partition_name)) { 1584 1580 log_to_screen("%s is mounted, and should not be partitioned", partition_name); 1585 paranoid_free(partition_name);1581 mr_free(partition_name); 1586 1582 return (1); 1587 1583 } … … 1603 1599 if (prev_partno >= 4) { 1604 1600 log_to_screen("You need to leave at least one partition free, for 'extended/logical'"); 1605 paranoid_free(partition_name);1601 mr_free(partition_name); 1606 1602 paranoid_free(output); 1607 1603 return (1); … … 1712 1708 mr_free(program); 1713 1709 mr_free(output); 1710 mr_free(partition_name); 1714 1711 1715 1712 g_current_progress++; 1716 1713 log_it("partition_device() --- leaving"); 1717 paranoid_free(partition_name);1718 1714 return (retval); 1719 1715 } … … 1804 1800 1805 1801 /** buffers *********************************************************/ 1806 char *partition ;1802 char *partition = NULL; 1807 1803 char *command = NULL; 1808 1804 char *output = NULL; … … 1821 1817 assert(format != NULL); 1822 1818 1823 malloc_string(partition); 1824 1825 build_partition_name(partition, drive, partno); 1819 partition = build_partition_name(drive, partno); 1826 1820 if (strcmp(format, "swap") == 0) { 1827 1821 mr_asprintf(partcode, "82"); … … 1872 1866 } 1873 1867 log_msg(1, "Setting %s's type to %s (%s)", partition, format, partcode); 1868 mr_free(partition); 1869 1874 1870 if ((strcmp(partcode,"") != 0) && strcmp(partcode, "83")) { /* no need to set type if 83: 83 is default */ 1875 1871 … … 1925 1921 } 1926 1922 mr_free(partcode); 1927 1928 paranoid_free(partition);1929 1923 1930 1924 return (res);
Note:
See TracChangeset
for help on using the changeset viewer.