Changeset 2334 in MondoRescue for branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
- Timestamp:
- Aug 18, 2009, 5:28:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2332 r2334 206 206 { 207 207 208 /** needs malloc **/209 208 char *command = NULL; 210 char *file ;211 char *tmp ;209 char *file = NULL; 210 char *tmp = NULL; 212 211 int res; 213 212 214 malloc_string(file);215 malloc_string(tmp);216 213 assert_string_is_neither_NULL_nor_zerolength(f); 217 214 assert_string_is_neither_NULL_nor_zerolength(list_fname); … … 219 216 220 217 if (strncmp(preamble, f, strlen(preamble)) == 0) { 221 strcpy(file, f + strlen(preamble));218 mr_asprintf(file, "%s", f + strlen(preamble)); 222 219 } else { 223 strcpy(file, f);220 mr_asprintf(file, "%s", f); 224 221 } 225 222 if (file[0] == '/' && file[1] == '/') { 226 strcpy(tmp, file); 227 strcpy(file, tmp + 1); 223 mr_asprintf(tmp, "%s", file); 224 mr_free(file); 225 226 mr_asprintf(file, "%s", tmp + 1); 227 mr_free(tmp); 228 228 } 229 229 log_msg(2, "Checking to see if f=%s, file=%s, is in the list of biggiefiles", f, file); 230 230 mr_asprintf(command, "grep -E '^%s$' %s", file, list_fname); 231 mr_free(file); 232 231 233 res = run_program_and_log_output(command, FALSE); 232 234 mr_free(command); 233 paranoid_free(file);234 mr_free(tmp);235 235 if (res) { 236 236 return (FALSE); … … 429 429 } 430 430 if (res) { 431 log_msg(1, "Unable to mount device %s (type %s) at %s", device, 432 format, mountdir); 431 log_msg(1, "Unable to mount device %s (type %s) at %s", device, format, mountdir); 433 432 log_msg(1, "command was '%s'", command); 434 433 if (!strcmp(mountpoint, "swap")) { … … 479 478 char *tmp = NULL; 480 479 char *these_failed = NULL; 481 char *format;482 480 struct mountlist_itself *mountlist = NULL; 483 484 malloc_string(format);485 481 486 482 assert(p_external_copy_of_mountlist != NULL); … … 511 507 update_progress_form(tmp); 512 508 mr_free(tmp); 513 strcpy(format, mountlist->el[lino].format); 514 res = mount_device(mountlist->el[lino].device, 515 mountlist->el[lino].mountpoint, 516 format, writeable); 509 res = mount_device(mountlist->el[lino].device, mountlist->el[lino].mountpoint, mountlist->el[lino].format, writeable); 510 517 511 retval += res; 518 512 if (res) { … … 556 550 run_program_and_log_output("df -m", 3); 557 551 paranoid_free(mountlist); 558 paranoid_free(format);559 552 return (retval); 560 553 } … … 728 721 char *iso_path = NULL; 729 722 char *old_isodir = NULL; 730 char cfg_file[100];723 char *cfg_file = NULL; 731 724 t_bkptype media_specified_by_user; 732 725 … … 736 729 737 730 if (!cfgf) { 738 strcpy(cfg_file, g_mondo_cfg_file);731 cfg_file = g_mondo_cfg_file; 739 732 } else { 740 strcpy(cfg_file, cfgf);733 cfg_file = cfgf; 741 734 } 742 735 … … 1495 1488 char *conffile; 1496 1489 char *tmp = NULL; 1497 char *editor ;1490 char *editor = NULL; 1498 1491 char *p = NULL; 1499 1492 … … 1501 1494 bool done; 1502 1495 1503 malloc_string(editor);1504 1496 malloc_string(rootdev); 1505 1497 malloc_string(rootdrive); 1506 1498 malloc_string(conffile); 1507 1499 assert_string_is_neither_NULL_nor_zerolength(bd); 1508 strcpy(editor, find_my_editor());1509 1500 mr_asprintf(boot_device, "%s", bd); 1510 1501 … … 1544 1535 newtSuspend(); 1545 1536 } 1537 mr_asprintf(editor, "%s", find_my_editor()); 1538 1546 1539 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1547 1540 paranoid_system(tmp); … … 1559 1552 paranoid_system(tmp); 1560 1553 mr_free(tmp); 1554 mr_free(editor); 1561 1555 1562 1556 if (!g_text_mode) { … … 1611 1605 paranoid_free(rootdrive); 1612 1606 paranoid_free(conffile); 1613 paranoid_free(editor);1614 1607 1615 1608 return (res); … … 1631 1624 char *command = NULL; 1632 1625 char *tmp = NULL; 1633 char *editor ;1626 char *editor = NULL; 1634 1627 1635 1628 int res; 1636 1629 int done; 1637 1630 1638 malloc_string(editor);1639 strcpy(editor, find_my_editor());1640 1631 if (offer_to_run_stabelilo 1641 1632 && ask_me_yes_or_no("Did you change the mountlist or cloned the system ?")) … … 1657 1648 newtSuspend(); 1658 1649 } 1650 mr_asprintf(editor, "%s", find_my_editor()); 1651 1659 1652 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1660 1653 paranoid_system(tmp); … … 1664 1657 paranoid_system(tmp); 1665 1658 mr_free(tmp); 1659 1660 mr_free(editor); 1666 1661 1667 1662 if (!g_text_mode) { … … 1682 1677 res = TRUE; 1683 1678 } 1684 paranoid_free(editor);1685 1679 return (res); 1686 1680 } … … 1701 1695 char *command = NULL; 1702 1696 char *tmp = NULL; 1703 char *editor ;1697 char *editor = NULL; 1704 1698 1705 1699 int res; 1706 1700 int done; 1707 1701 bool run_lilo_M = FALSE; 1708 malloc_string(editor);1709 1702 1710 1703 if (!run_program_and_log_output … … 1713 1706 } 1714 1707 1715 strcpy(editor, find_my_editor());1716 1708 if (offer_to_run_stablilo 1717 1709 && ask_me_yes_or_no("Did you change the mountlist or cloned the system ?")) … … 1733 1725 newtSuspend(); 1734 1726 } 1727 mr_asprintf(editor, "%s", find_my_editor()); 1728 1735 1729 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor); 1736 1730 paranoid_system(tmp); … … 1740 1734 paranoid_system(tmp); 1741 1735 mr_free(tmp); 1736 1737 mr_free(editor); 1742 1738 1743 1739 if (!g_text_mode) { … … 1795 1791 " lilo -M /dev/sda", 3); 1796 1792 } 1797 paranoid_free(editor);1798 1793 return (res); 1799 1794 } … … 1821 1816 int done; 1822 1817 1823 malloc_string(editor);1824 1818 assert_string_is_neither_NULL_nor_zerolength(bd); 1825 1819 1826 strcpy(editor, find_my_editor());1827 1820 mr_asprintf(boot_device, "%s", bd); 1828 1821 … … 1838 1831 newtSuspend(); 1839 1832 } 1833 mr_asprintf(editor, "%s", find_my_editor()); 1840 1834 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor); 1835 mr_free(editor); 1836 1841 1837 paranoid_system(tmp); 1842 1838 mr_free(tmp); … … 1884 1880 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1885 1881 } 1886 paranoid_free(editor);1887 1882 return (res); 1888 1883 }
Note:
See TracChangeset
for help on using the changeset viewer.