Changeset 3185 in MondoRescue for branches/3.0/mondo/src/common/libmondo-devices.c
- Timestamp:
- Sep 20, 2013, 2:29:57 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-devices.c
r3171 r3185 131 131 132 132 malloc_string(comment); 133 mr_asprintf( &tmp, "%s", where_is_root_mounted());133 mr_asprintf(tmp, "%s", where_is_root_mounted()); 134 134 sprintf(comment, "root is mounted at %s\n", tmp); 135 135 log_msg(0, comment); … … 555 555 run_program_and_log_output("insmod ide-scsi", -1); 556 556 if (find_home_of_exe("cdrecord")) { 557 mr_asprintf( &cdr_exe, "cdrecord");557 mr_asprintf(cdr_exe, "cdrecord"); 558 558 } else { 559 mr_asprintf( &cdr_exe, "dvdrecord");559 mr_asprintf(cdr_exe, "dvdrecord"); 560 560 } 561 561 if (find_home_of_exe(cdr_exe)) { … … 563 563 "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", 564 564 cdr_exe); 565 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));565 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 566 566 } 567 567 if ((tmp == NULL) || (strlen(tmp) < 2)) { … … 653 653 654 654 if (find_home_of_exe("cdrecord")) { 655 mr_asprintf( &cdr_exe, "cdrecord");655 mr_asprintf(cdr_exe, "cdrecord"); 656 656 } else { 657 mr_asprintf( &cdr_exe, "dvdrecord");657 mr_asprintf(cdr_exe, "dvdrecord"); 658 658 } 659 659 tmp[0] = '\0'; … … 876 876 cdr_exe, g_cdrw_drive_is_here); 877 877 log_msg(1, "command=%s", command); 878 mr_asprintf( &tmp1, "%s", call_program_and_get_last_line_of_output(command));878 mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command)); 879 879 if (strlen(tmp1) > 0) { 880 880 strcpy(output, tmp1); … … 1134 1134 log_msg(1, "%s needs to have a '/' prefixed - I'll do it", 1135 1135 device_raw); 1136 mr_asprintf( &tmp, "/%s", device_raw);1136 mr_asprintf(tmp, "/%s", device_raw); 1137 1137 } else { 1138 mr_asprintf( &tmp, "%s", device_raw);1138 mr_asprintf(tmp, "%s", device_raw); 1139 1139 } 1140 1140 log_msg(1, "Is %s mounted?", tmp); … … 1145 1145 return(FALSE); 1146 1146 } 1147 mr_asprintf( &device_with_tab, "%s\t", tmp);1148 mr_asprintf( &device_with_space, "%s ", tmp);1147 mr_asprintf(device_with_tab, "%s\t", tmp); 1148 mr_asprintf(device_with_space, "%s ", tmp); 1149 1149 mr_free(tmp); 1150 1150 … … 1165 1165 mr_free(device_with_tab); 1166 1166 paranoid_pclose(fin); 1167 mr_asprintf( &tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);1167 mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space); 1168 1168 mr_free(device_with_space); 1169 1169 log_msg(4, "tmp (command) = '%s'", tmp); … … 1309 1309 } 1310 1310 #ifndef __FreeBSD__ 1311 mr_asprintf( &options, "ro");1311 mr_asprintf(options, "ro"); 1312 1312 #endif 1313 1313 … … 1315 1315 1316 1316 #ifdef __FreeBSD__ 1317 mr_asprintf( &dev, "%s", make_vn(device));1317 mr_asprintf(dev, "%s", make_vn(device)); 1318 1318 if (!dev) { 1319 mr_asprintf( &command, "Unable to mount ISO (make_vn(%s) failed)", device);1319 mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device); 1320 1320 fatal_error(command); 1321 1321 } … … 1332 1332 1333 1333 #ifdef __FreeBSD__ 1334 mr_asprintf( &command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);1334 mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1335 1335 1336 1336 #else 1337 mr_asprintf( &command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);1337 mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE); 1338 1338 paranoid_free(options); 1339 1339 #endif … … 1407 1407 } else if (bkpinfo->backup_media_type == iso) { 1408 1408 if (bkpinfo->subdir) { 1409 mr_asprintf( &mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir);1409 mr_asprintf(mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir); 1410 1410 } else { 1411 mr_asprintf( &mountdir, "%s", bkpinfo->isodir);1411 mr_asprintf(mountdir, "%s", bkpinfo->isodir); 1412 1412 } 1413 1413 #ifdef __FreeBSD__ … … 1673 1673 ********/ 1674 1674 /* Get the number of mounted file systems ((those that start with "/dev/" */ 1675 mr_asprintf( &command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");1675 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l"); 1676 1676 log_msg(5, "Running: %s", command); 1677 mr_asprintf( &mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));1677 mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command)); 1678 1678 paranoid_free(command); 1679 1679 … … 1683 1683 1684 1684 for (i=mount_cnt; i > 0; i--) { 1685 mr_asprintf( &command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);1685 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i); 1686 1686 log_msg(5, "Running: %s", command); 1687 mr_asprintf( &mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));1687 mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command)); 1688 1688 paranoid_free(command); 1689 1689 … … 1770 1770 log_msg(4, " %s looks like a device special file", dsf); 1771 1771 /* Verify that the dsf exists */ 1772 mr_asprintf( &command, "ls -al %s 2>/dev/null | wc -l", dsf);1772 mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf); 1773 1773 log_msg(5, " Executing: %s", command); 1774 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1774 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1775 1775 paranoid_free(command); 1776 1776 … … 1796 1796 * Either way, it's an error. 1797 1797 ********/ 1798 mr_asprintf( &command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);1798 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 1799 1799 log_msg(5, "Executing: %s", command); 1800 mr_asprintf( &partition_list, "%s", call_program_and_get_last_line_of_output(command));1800 mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command)); 1801 1801 paranoid_free(command); 1802 1802 log_msg(4, "Partition list for %s: %s", dsf, partition_list); … … 1816 1816 mr_free(token); 1817 1817 } 1818 mr_asprintf( &ndsf, "%s", dsf);1818 mr_asprintf(ndsf, "%s", dsf); 1819 1819 } 1820 1820 mr_free(partition_list); … … 1862 1862 log_msg(4, "Processing partition: %s", partitions[i]); 1863 1863 /* See if it's swap. If it is, ignore it. */ 1864 mr_asprintf( &command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",1864 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", 1865 1865 ndsf, partitions[i]); 1866 1866 log_msg(5, " Running: %s", command); 1867 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1867 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1868 1868 paranoid_free(command); 1869 1869 log_msg(5, " Return value: %s", tmp); … … 1875 1875 } 1876 1876 /* It's not swap. See if we can find the mount point from the mount command. */ 1877 mr_asprintf( &command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);1878 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1877 mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]); 1878 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1879 1879 paranoid_free(command); 1880 1880 if (strlen(tmp)) { … … 1893 1893 log_msg(4, " It's not mounted. Checking to see if it's LVM..."); 1894 1894 /* Check for LVM */ 1895 mr_asprintf( &command, "pvdisplay -c %s 2> /dev/null", partitions[i]);1895 mr_asprintf(command, "pvdisplay -c %s 2> /dev/null", partitions[i]); 1896 1896 log_msg(5, " Running: %s", command); 1897 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1897 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1898 1898 paranoid_free(command); 1899 1899 if (strlen(tmp)) { 1900 1900 log_msg(4, "Found an LVM partition at %s. Find the VG it's in...", partitions[i]); 1901 1901 /* It's LVM: Find the VG it's in */ 1902 mr_asprintf( &command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);1902 mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]); 1903 1903 log_msg(5, " Running: %s", command); 1904 1904 strcpy(VG, call_program_and_get_last_line_of_output(command)); … … 1908 1908 /* Found the Volume Group. Now find all of the VG's mount points */ 1909 1909 log_msg(4, " Found the Volume Group. Now find all of the VG's mount points"); 1910 mr_asprintf( &command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);1910 mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 1911 1911 log_msg(5, " Running: %s", command); 1912 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));1912 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 1913 1913 paranoid_free(command); 1914 1914 log_msg(4, " VG %s mount_list: %s", VG, mount_list); … … 1931 1931 paranoid_free(mount_list); 1932 1932 1933 mr_asprintf( &command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");1933 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1934 1934 log_msg (5, "Running: %s", command); 1935 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));1935 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 1936 1936 paranoid_free(command); 1937 1937 log_msg(4, " Software raid device list: %s", mount_list); 1938 1938 lastpos = 0; 1939 1939 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 1940 mr_asprintf( &command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);1940 mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 1941 1941 log_msg (5, "Running: %s", command); 1942 1942 paranoid_free(tmp); 1943 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1943 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1944 1944 paranoid_free(command); 1945 1945 log_msg(4, "Number of Software raid device: %s", tmp); … … 1972 1972 ********/ 1973 1973 log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device."); 1974 mr_asprintf( &command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);1974 mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]); 1975 1975 log_msg(4, " Running: %s", command); 1976 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1976 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1977 1977 paranoid_free(command); 1978 1978 if (!strlen(tmp)) { … … 1983 1983 log_msg (5, " UUID: %s", tmp); 1984 1984 /* Get the Software raid device list */ 1985 mr_asprintf( &command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");1985 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1986 1986 log_msg (5, " Running: %s", command); 1987 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));1987 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 1988 1988 paranoid_free(command); 1989 1989 log_msg(4, " Software raid device list: %s", mount_list); … … 1991 1991 lastpos = 0; 1992 1992 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 1993 mr_asprintf( &command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);1993 mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp); 1994 1994 log_msg(4, " Running: %s", command); 1995 1995 paranoid_free(tmp); 1996 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1996 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1997 1997 paranoid_free(command); 1998 1998 if (!atoi(tmp)) { … … 2088 2088 mr_strcat(bkpinfo->exclude_paths,"|%s",mounted_on_dsf); 2089 2089 } else { 2090 mr_asprintf( &(bkpinfo->exclude_paths),"%s",mounted_on_dsf);2090 mr_asprintf(bkpinfo->exclude_paths,"%s",mounted_on_dsf); 2091 2091 } 2092 2092 if (bkpinfo->exclude_devs) { 2093 2093 mr_strcat(bkpinfo->exclude_devs,"|%s",token); 2094 2094 } else { 2095 mr_asprintf( &(bkpinfo->exclude_devs),"%s",token);2095 mr_asprintf(bkpinfo->exclude_devs,"%s",token); 2096 2096 } 2097 2097 } … … 2107 2107 mr_strcat(bkpinfo->exclude_paths, "|%s",not_mounted_on_dsf); 2108 2108 } else { 2109 mr_asprintf( &(bkpinfo->exclude_paths),"%s",not_mounted_on_dsf);2109 mr_asprintf(bkpinfo->exclude_paths,"%s",not_mounted_on_dsf); 2110 2110 } 2111 2111 } … … 2119 2119 case -1: 2120 2120 /* Adds a | to ensure correct detection even at both ends */ 2121 mr_asprintf( &tmp1,"|%s",token);2122 mr_asprintf( &tmp2,"|%s|",token);2121 mr_asprintf(tmp1,"|%s",token); 2122 mr_asprintf(tmp2,"|%s|",token); 2123 2123 if (mode == 'E') { 2124 2124 /* Add the token if not already in the list */ 2125 mr_asprintf( &tmp,"|%s|",bkpinfo->exclude_paths);2125 mr_asprintf(tmp,"|%s|",bkpinfo->exclude_paths); 2126 2126 if (strstr(tmp,tmp2) == NULL) { 2127 2127 if (bkpinfo->exclude_paths) { … … 2134 2134 } else { 2135 2135 /* Add the token if not already in the list */ 2136 mr_asprintf( &tmp,"|%s|",bkpinfo->include_paths);2136 mr_asprintf(tmp,"|%s|",bkpinfo->include_paths); 2137 2137 if (strstr(tmp,tmp2) == NULL) { 2138 2138 strcat(bkpinfo->include_paths,tmp1); … … 2219 2219 */ 2220 2220 #ifdef __FreeBSD__ 2221 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));2221 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done")); 2222 2222 #else 2223 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));2223 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done")); 2224 2224 #endif 2225 2225 2226 2226 if (tmp[0] != '/') { 2227 mr_asprintf( &sz, "%s", tmp);2227 mr_asprintf(sz, "%s", tmp); 2228 2228 mr_free(tmp); 2229 mr_asprintf( &tmp, "/%s", sz);2229 mr_asprintf(tmp, "/%s", sz); 2230 2230 mr_free(sz); 2231 2231 } … … 2337 2337 if (bkpinfo->media_device[0]) { 2338 2338 if (bkpinfo->backup_media_type == usb) { 2339 mr_asprintf( &tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);2339 mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device); 2340 2340 } else { 2341 mr_asprintf( &tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);2341 mr_asprintf(tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device); 2342 2342 } 2343 2343 if (!ask_me_yes_or_no(tmp)) { … … 2405 2405 } 2406 2406 if (bkpinfo->media_device[0]) { 2407 mr_asprintf( &tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);2407 mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device); 2408 2408 if (!ask_me_yes_or_no(tmp)) { 2409 2409 bkpinfo->media_device[0] = '\0'; … … 2420 2420 } 2421 2421 } 2422 mr_asprintf( &tmp, "ls -l %s", bkpinfo->media_device);2422 mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device); 2423 2423 if (run_program_and_log_output(tmp, FALSE)) { 2424 2424 log_to_screen("User has not specified a valid /dev entry"); … … 2535 2535 /* Force NFS to be the protocol by default */ 2536 2536 if (bkpinfo->netfs_proto == NULL) { 2537 mr_asprintf( &(bkpinfo->netfs_proto), "nfs");2537 mr_asprintf(bkpinfo->netfs_proto, "nfs"); 2538 2538 } 2539 2539 if (bkpinfo->disaster_recovery) { … … 2549 2549 } 2550 2550 mr_free(bkpinfo->netfs_proto); 2551 mr_asprintf( &(bkpinfo->netfs_proto), "%s", tmp1);2551 mr_asprintf(bkpinfo->netfs_proto, "%s", tmp1); 2552 2552 if (!popup_and_get_string 2553 2553 ("Network share", "Which remote share should I mount?", … … 2570 2570 mr_free(bkpinfo->netfs_user); 2571 2571 if (strcmp(tmp1, "") != 0) { 2572 mr_asprintf( &(bkpinfo->netfs_user), "%s", tmp1);2572 mr_asprintf(bkpinfo->netfs_user, "%s", tmp1); 2573 2573 } 2574 2574 … … 2585 2585 if (bkpinfo->restore_data) { 2586 2586 /* mount th FS read-only in restore mode to avoid any erase of whatever */ 2587 mr_asprintf( &tmpro, "-o ro");2587 mr_asprintf(tmpro, "-o ro"); 2588 2588 } else { 2589 mr_asprintf( &tmpro, "");2589 mr_asprintf(tmpro, ""); 2590 2590 } 2591 2591 2592 2592 /* Build the mount string */ 2593 2593 if (strstr(bkpinfo->netfs_proto, "smbfs")) { 2594 mr_asprintf( &tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro);2594 mr_asprintf(tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro); 2595 2595 if (bkpinfo->netfs_user) { 2596 2596 mr_strcat(tmp, " -o user=%s", bkpinfo->netfs_user); … … 2598 2598 else { 2599 2599 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 2600 mr_asprintf( &tmp, "sshfs %s ",tmpro);2600 mr_asprintf(tmp, "sshfs %s ",tmpro); 2601 2601 } else { 2602 mr_asprintf( &tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro);2602 mr_asprintf(tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro); 2603 2603 } 2604 2604 if (bkpinfo->netfs_user) { … … 2788 2788 } 2789 2789 mr_free(bkpinfo->exclude_paths); 2790 mr_asprintf( &tmp, "%s", p);2790 mr_asprintf(tmp, "%s", p); 2791 2791 bkpinfo->exclude_paths = tmp; 2792 2792 … … 2815 2815 if (ask_me_yes_or_no("Do you want to backup extended attributes?")) { 2816 2816 if (find_home_of_exe("getfattr")) { 2817 mr_asprintf( &g_getfattr,"getfattr");2817 mr_asprintf(g_getfattr,"getfattr"); 2818 2818 } 2819 2819 if (find_home_of_exe("getfacl")) { 2820 mr_asprintf( &g_getfacl,"getfacl");2820 mr_asprintf(g_getfacl,"getfacl"); 2821 2821 } 2822 2822 log_it("Backup of extended attributes"); … … 2934 2934 char *exclude_these_directories = NULL; 2935 2935 2936 mr_asprintf( &exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'"));2936 mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'")); 2937 2937 log_msg(9,"list_of_NETFS_mounts_only returns %s\n",exclude_these_directories); 2938 2938 return(exclude_these_directories); … … 3033 3033 // log_it("Asking what_number_cd_is_this"); 3034 3034 if (g_ISO_restore_mode) { 3035 mr_asprintf( &tmp, "mount | grep iso9660 | awk '{print $3;}'");3036 3037 mr_asprintf( &mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");3035 mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'"); 3036 3037 mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER"); 3038 3038 cd_number = atoi(last_line_of_file(mountdev)); 3039 3039 paranoid_free(mountdev); … … 3043 3043 } 3044 3044 3045 mr_asprintf( &mountdev, "%s", bkpinfo->media_device);3045 mr_asprintf(mountdev, "%s", bkpinfo->media_device); 3046 3046 if (!mountdev[0]) { 3047 3047 log_it … … 3177 3177 assert(which_device != NULL); 3178 3178 3179 mr_asprintf( &list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());3179 mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted()); 3180 3180 log_it("list_drives_cmd = %s", list_drives_cmd); 3181 3181 … … 3219 3219 } else { 3220 3220 // We need to look on each partition then 3221 mr_asprintf( &list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");3221 mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 3222 3222 log_it("list_drives_cmd = %s", list_drives_cmd); 3223 3223 … … 3322 3322 log_msg(1, "curr_fname = %s", curr_fname); 3323 3323 sprintf(command, "file %s", curr_fname); 3324 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));3324 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3325 3325 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 3326 3326 p--); 3327 3327 p++; 3328 mr_asprintf( &scratch, "%s", p);3328 mr_asprintf(scratch, "%s", p); 3329 3329 for (p = scratch; *p != '\0' && *p != '\''; p++); 3330 3330 *p = '\0'; … … 3373 3373 sprintf(fdisk, "/sbin/parted2fdisk"); 3374 3374 sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive); 3375 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));3375 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3376 3376 if (strstr(tmp, "GPT") == NULL) { 3377 3377 strcpy(output, "MBR");
Note:
See TracChangeset
for help on using the changeset viewer.