Changeset 2291 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-devices.c
- Timestamp:
- Jul 22, 2009, 2:11:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2266 r2291 1142 1142 mr_free(device_with_space); 1143 1143 paranoid_pclose(fin); 1144 mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", 1145 SWAPLIST_COMMAND, device_with_space); 1144 mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space); 1146 1145 log_msg(4, "tmp (command) = '%s'", tmp); 1147 1146 if (!system(tmp)) { … … 1292 1291 1293 1292 #ifdef __FreeBSD__ 1294 mr_asprintf(&dev, make_vn(device));1293 mr_asprintf(&dev, "%s", make_vn(device)); 1295 1294 if (!dev) { 1296 1295 mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device); … … 1309 1308 1310 1309 #ifdef __FreeBSD__ 1311 mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", 1312 device, mountpoint, MONDO_LOGFILE); 1310 mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1313 1311 1314 1312 #else 1315 mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", 1316 device, options, mountpoint, MONDO_LOGFILE); 1313 mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE); 1317 1314 paranoid_free(options); 1318 1315 #endif … … 1609 1606 if (bkpinfo->media_device[0]) { 1610 1607 if (bkpinfo->backup_media_type == usb) { 1611 mr_asprintf(&tmp, 1612 "I think your %s media corresponds to %s. Is this correct?", mds, 1613 bkpinfo->media_device); 1608 mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device); 1614 1609 } else { 1615 mr_asprintf(&tmp, 1616 "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, 1617 bkpinfo->media_device); 1610 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); 1618 1611 } 1619 1612 if (!ask_me_yes_or_no(tmp)) { … … 1683 1676 } 1684 1677 if (bkpinfo->media_device[0]) { 1685 mr_asprintf(&tmp, 1686 "I think I've found your tape streamer at %s; am I right on the money?", 1687 bkpinfo->media_device); 1678 mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device); 1688 1679 if (!ask_me_yes_or_no(tmp)) { 1689 1680 bkpinfo->media_device[0] = '\0'; … … 1812 1803 mr_free(command); 1813 1804 1814 mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, 1815 bkpinfo->isodir); 1805 mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir); 1816 1806 run_program_and_log_output(tmp, 3); 1817 1807 mr_free(tmp); … … 1825 1815 finish(1); 1826 1816 } 1827 mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);1817 mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir); 1828 1818 if (!popup_and_get_string 1829 1819 ("Directory", "Which directory within that mountpoint?", tmp, … … 1977 1967 mr_free(tmp); 1978 1968 // NTFS 1979 mr_asprintf(&tmp, "%s", 1980 call_program_and_get_last_line_of_output 1981 ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1969 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1982 1970 if (strlen(tmp) > 2) { 1983 1971 if (!popup_and_get_string … … 2105 2093 2106 2094 mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only()); 2107 mr_asprintf(&exclude_these_devices,"%s", 2108 call_program_and_get_last_line_of_output 2109 ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2095 mr_asprintf(&exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2110 2096 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2111 2097 mr_free(exclude_these_devices); … … 2128 2114 static char result_sz[512]; 2129 2115 2130 mr_asprintf(&exclude_these_directories,"%s", 2131 call_program_and_get_last_line_of_output 2132 ("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2116 mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2133 2117 snprintf(result_sz, 511, "%s", exclude_these_directories); 2134 2118 mr_free(exclude_these_directories); … … 2184 2168 2185 2169 #ifdef __FreeBSD__ 2186 mr_asprintf(&tmp, 2187 call_program_and_get_last_line_of_output 2188 ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2170 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2189 2171 #else 2190 mr_asprintf(&tmp, 2191 call_program_and_get_last_line_of_output 2192 ("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2172 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2193 2173 #endif 2194 2174 2195 2175 if (tmp[0] != '/') { 2196 mr_asprintf(&sz, tmp);2176 mr_asprintf(&sz, "%s", tmp); 2197 2177 paranoid_free(tmp); 2198 2178 mr_asprintf(&tmp, "/%s", sz); … … 2292 2272 } 2293 2273 2294 mr_asprintf(&mountdev, bkpinfo->media_device);2274 mr_asprintf(&mountdev, "%s", bkpinfo->media_device); 2295 2275 if (!mountdev[0]) { 2296 2276 log_it … … 2425 2405 assert(which_device != NULL); 2426 2406 2427 mr_asprintf(&list_drives_cmd, 2428 "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", 2429 where_is_root_mounted()); 2407 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()); 2430 2408 log_it("list_drives_cmd = %s", list_drives_cmd); 2431 2409 … … 2469 2447 } else { 2470 2448 // We need to look on each partition then 2471 mr_asprintf(&list_drives_cmd, 2472 "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2449 mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2473 2450 log_it("list_drives_cmd = %s", list_drives_cmd); 2474 2451 … … 2572 2549 log_msg(1, "curr_fname = %s", curr_fname); 2573 2550 mr_asprintf(&command, "file %s", curr_fname); 2574 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2551 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 2575 2552 mr_free(command); 2576 2553 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 2577 2554 p--); 2578 2555 p++; 2579 mr_asprintf(&scratch, p);2556 mr_asprintf(&scratch, "%s", p); 2580 2557 for (p = scratch; *p != '\0' && *p != '\''; p++); 2581 2558 *p = '\0'; … … 2626 2603 mr_free(fdisk); 2627 2604 2628 mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));2605 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 2629 2606 mr_free(command); 2630 2607
Note:
See TracChangeset
for help on using the changeset viewer.