Changeset 3859 in MondoRescue for branches/3.3/mondo/src/mondorestore
- Timestamp:
- Mar 7, 2024, 1:33:54 AM (14 months ago)
- Location:
- branches/3.3/mondo/src/mondorestore
- Files:
-
- 2 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); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-mountlist.c
r3611 r3859 54 54 55 55 /*@ buffers ******************************************************** */ 56 char tmp = NULL;57 char tmp1 = NULL;58 char device[MAX_STR_LEN];56 char *tmp = NULL; 57 char *tmp1 = NULL; 58 char *device = NULL; 59 59 60 60 char *flaws_str = NULL; … … 86 86 /* check DD */ 87 87 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 88 sprintf(device, "%s%c", drive, cur_sp_no);88 mr_asprintf(device, "%s%c", drive, cur_sp_no); 89 89 if (find_device_in_mountlist(mountlist, device) >= 0) 90 90 foundsome = TRUE; … … 92 92 if (foundsome) { 93 93 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 94 sprintf(device, "%s%c", drive, cur_sp_no);94 mr_asprintf(device, "%s%c", drive, cur_sp_no); 95 95 pos = find_device_in_mountlist(mountlist, device); 96 96 if (pos < 0) { … … 160 160 npos = pos = 0; 161 161 for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) { 162 build_partition_name(device,drive, curr_part_no);162 device = build_partition_name(drive, curr_part_no); 163 163 pos = find_device_in_mountlist(mountlist, device); 164 164 npos = 0; 165 165 for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) { 166 sprintf(device, "%ss%i%c", device, curr_part_no, cur_sp_no);166 mr_asprintf(device, "%ss%i%c", device, curr_part_no, cur_sp_no); 167 167 if (find_device_in_mountlist(mountlist, device) >= 0) 168 168 npos++; … … 170 170 if (((pos >= 0) || npos) && foundsome) { 171 171 mr_strcat(flaws_str, " %s has both DD and PC-style partitions.", drive); 172 mr_free(device); 172 173 return(flaws_str); // fatal error 173 174 } 174 175 175 build_partition_name(device, drive, curr_part_no);176 176 if (pos > 0 && !npos) { 177 177 /* gap in the partition list? */ … … 255 255 /* Check subpartitions */ 256 256 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 257 sprintf(device, "%ss%d%c", drive, curr_part_no, cur_sp_no);257 mr_asprintf(device, "%ss%d%c", drive, curr_part_no, cur_sp_no); 258 258 pos = find_device_in_mountlist(mountlist, device); 259 259 if (pos < 0) { … … 344 344 } 345 345 prev_part_no = curr_part_no; 346 mr_free(device); 346 347 } 347 348 … … 397 398 mr_asprintf(flaws_str, "%s", ""); 398 399 399 malloc_string(device);400 400 prev_part_no = 0; 401 401 … … 421 421 422 422 for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) { 423 build_partition_name(device,drive, curr_part_no);423 device = build_partition_name(drive, curr_part_no); 424 424 pos = find_device_in_mountlist(mountlist, device); 425 425 if (pos < 0) { … … 520 520 521 521 endoffunc: 522 paranoid_free(device);522 mr_free(device); 523 523 524 524 if (res == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.