Changeset 2436 in MondoRescue for branches/2.2.9/mondo/src/common/libmondo-devices.c
- Timestamp:
- Sep 29, 2009, 1:48:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/libmondo-devices.c
r2434 r2436 1550 1550 int i = 0; 1551 1551 int mount_cnt = 0; 1552 int lastpos = 0; 1552 1553 char *mounted_file_system = NULL; 1553 1554 char *command = NULL; … … 1580 1581 1581 1582 log_msg (5, "mounted_file_system: %s", mounted_file_system); 1582 if ((token = strtok(mounted_file_system, token_chars)) == NULL) {1583 if ((token = mr_strtok(mounted_file_system, token_chars, &lastpos)) == NULL) { 1583 1584 log_msg (4, "Could not get the list of mounted file systems"); 1584 1585 paranoid_free(mounted_file_system); … … 1597 1598 strcpy(DSFptr->device, token); 1598 1599 mr_free(token); 1599 if ((token = strtok(NULL, token_chars)) == NULL) {1600 if ((token = mr_strtok(mounted_file_system, token_chars, &lastpos)) == NULL) { 1600 1601 log_msg (5, "Ran out of entries on the mounted file systems list"); 1601 paranoid_free(mounted_file_system);1602 mr_free(mounted_file_system); 1602 1603 mr_free(token); 1603 1604 return (1); … … 1606 1607 strcpy(DSFptr->mount_point, token); 1607 1608 mr_free(token); 1608 token = strtok(NULL, token_chars);1609 } 1610 paranoid_free(mounted_file_system);1609 token = mr_strtok(mounted_file_system, token_chars, &lastpos); 1610 } 1611 mr_free(mounted_file_system); 1611 1612 } 1612 1613 /******** … … 1644 1645 char *mount_list = NULL; 1645 1646 char *token = NULL; 1647 char *ndsf = NULL; 1646 1648 char token_chars[] =" \t\r\f\a\0"; 1647 1649 MOUNTED_FS_STRUCT *DSFptr = NULL; … … 1693 1695 if (!strlen(partition_list)) { 1694 1696 /* There were no partitions on the disk */ 1695 log_msg(4, "Cannot find any partitions on device special file %s", dsf); 1696 return (-2); 1697 } 1698 1699 /* Fill the partition list */ 1700 i = 0; 1701 lastpos = 0; 1702 while ((token = mr_strtok(partition_list, token_chars, &lastpos)) != NULL) { 1703 log_msg (5, "Found partition: %s", token); 1704 strcpy(partitions[i++], token); 1705 mr_free(token); 1706 } 1707 paranoid_free(partition_list); 1697 log_msg(4, "No partitions on device special file %s", dsf); 1698 log_msg(4, "I guess it's a partiion itself"); 1699 strcpy(partitions[0], dsf); 1700 ndsf = truncate_to_drive_name(dsf); 1701 } else { 1702 /* Fill the partition list */ 1703 i = 0; 1704 lastpos = 0; 1705 while ((token = mr_strtok(partition_list, token_chars, &lastpos)) != NULL) { 1706 log_msg (5, "Found partition: %s", token); 1707 strcpy(partitions[i++], token); 1708 mr_free(token); 1709 } 1710 mr_asprintf(ndsf, "%s", dsf); 1711 } 1712 mr_free(partition_list); 1708 1713 1714 /* For the rest ndsf is the new dsf to deal with */ 1709 1715 /******** 1710 1716 * At this point, we have a list of all of the partitions on the dsf. Now try to … … 1740 1746 /* See if it's swap. If it is, ignore it. */ 1741 1747 mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", 1742 dsf, partitions[i]);1748 ndsf, partitions[i]); 1743 1749 log_msg(4, " Running: %s", command); 1744 1750 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); … … 1770 1776 log_msg(4, " It's not mounted. Checking to see if it's LVM..."); 1771 1777 /* Get the partition ID; 8e for LVM */ 1772 mr_asprintf(&command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);1778 mr_asprintf(&command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", ndsf, partitions[i]); 1773 1779 log_msg(4, " Running: %s", command); 1774 1780 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); … … 1809 1815 *******/ 1810 1816 paranoid_free(mount_list); 1817 1811 1818 mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1812 1819 log_msg (5, "Running: %s", command); … … 1890 1897 } 1891 1898 paranoid_free(tmp); 1892 } 1893 paranoid_free(partition_list); 1894 paranoid_free(mount_list); 1899 paranoid_free(mount_list); 1900 } 1895 1901 1896 1902 /* Determine how much memory to allocate for included_dsf_list and excluded_dsf_list */ … … 1911 1917 while (DSFptr != NULL) { 1912 1918 if (DSFptr->check) { 1913 log_msg (5, "%s is mounted on %s and is on disk %s\n", DSFptr->device, DSFptr->mount_point, dsf);1919 log_msg (5, "%s is mounted on %s and is on disk %s\n", DSFptr->device, DSFptr->mount_point, ndsf); 1914 1920 strcat(*included_dsf_list, DSFptr->mount_point); 1915 1921 strcat(*included_dsf_list, " "); 1916 1922 } else { 1917 log_msg (4, "%s is mounted on %s and is NOT on disk %s\n", DSFptr->device, DSFptr->mount_point, dsf);1923 log_msg (4, "%s is mounted on %s and is NOT on disk %s\n", DSFptr->device, DSFptr->mount_point, ndsf); 1918 1924 strcat(*excluded_dsf_list, DSFptr->mount_point); 1919 1925 strcat(*excluded_dsf_list, " "); … … 1921 1927 DSFptr = DSFptr->next; 1922 1928 } 1929 mr_free(ndsf); 1930 1923 1931 log_msg (5, "included_dsf_list: %s", *included_dsf_list); 1924 1932 log_msg (5, "excluded_dsf_list: %s", *excluded_dsf_list);
Note:
See TracChangeset
for help on using the changeset viewer.