Changeset 2324 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-devices.c
- Timestamp:
- Aug 18, 2009, 3:13:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2323 r2324 108 108 { 109 109 char *tmp = NULL; 110 char *comment = NULL;111 110 bool is_this_a_ramdisk = FALSE; 112 111 113 112 mr_asprintf(tmp, "%s", where_is_root_mounted()); 114 mr_asprintf(comment, "root is currently mounted at %s\n", tmp); 115 log_msg(0, comment); 116 mr_free(comment); 113 log_msg(0, "root is currently mounted at %s\n", tmp); 117 114 118 115 #ifdef __FreeBSD__ … … 221 218 mr_asprintf(command, "cdcontrol -f %s eject", dev); 222 219 } else { 223 mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`", 224 dev); 220 mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`", dev); 225 221 } 226 222 #else … … 500 496 { 501 497 /*@ buffers ************************ */ 502 char *comment = NULL;503 498 char *tmp = NULL; 504 499 char *cdr_exe = NULL; … … 532 527 } else { 533 528 strcpy(cdrw_device, tmp); 534 mr_asprintf(comment, "Found CDRW device - %s", cdrw_device); 535 log_it(comment); 529 log_it("Found CDRW device - %s", cdrw_device); 536 530 strcpy(g_cdrw_drive_is_here, cdrw_device); 537 mr_free(comment);538 531 mr_free(tmp); 539 532 mr_free(cdr_exe); … … 876 869 } 877 870 878 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 879 ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 871 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 880 872 ); 881 873 log_msg(5, "tmp = '%s'", tmp); 882 874 if (!tmp[0]) 883 875 mr_free(tmp); 884 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 885 ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 876 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 886 877 ); 887 878 if (tmp[0]) { … … 1090 1081 malloc_string(incoming); 1091 1082 assert(device_raw != NULL); 1092 // assert_string_is_neither_NULL_nor_zerolength(device_raw);1093 1083 if (device_raw[0] != '/' && !strstr(device_raw, ":/")) { 1094 1084 log_msg(1, "%s needs to have a '/' prefixed - I'll do it", … … 1372 1362 log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir); 1373 1363 mr_free(bkpinfo->isodir); 1374 mr_asprintf(p, "%s/isodir", bkpinfo->tmpdir); 1375 bkpinfo->isodir = p; 1364 mr_asprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir); 1376 1365 } 1377 1366 } … … 1387 1376 cd_number_i_want); 1388 1377 mds = media_descriptor_string(bkpinfo->backup_media_type); 1389 mr_asprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want);1378 log_msg(3, "Insisting on %s #%d", mds, cd_number_i_want); 1390 1379 mr_asprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want); 1391 1380 mr_free(mds); 1392 log_msg(3, tmp);1393 mr_free(tmp);1394 1381 1395 1382 while (what_number_cd_is_this() != cd_number_i_want) { … … 1731 1718 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount); 1732 1719 mr_free(bkpinfo->isodir); 1733 mr_asprintf(p, "%s", call_program_and_get_last_line_of_output(command)); 1734 bkpinfo->isodir = p; 1720 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(command)); 1735 1721 mr_free(command); 1736 1722 … … 1772 1758 mr_free(bkpinfo->isodir); 1773 1759 if (is_this_device_mounted(bkpinfo->nfs_mount)) { 1774 mr_asprintf(p, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1775 bkpinfo->isodir = p; 1760 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1776 1761 1777 1762 } else { 1778 mr_asprintf(p, "%s/nfsdir", bkpinfo->tmpdir); 1779 bkpinfo->isodir = p; 1763 mr_asprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir); 1780 1764 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 1781 1765 run_program_and_log_output(command, 5); … … 1790 1774 } 1791 1775 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 1792 popup_and_OK 1793 ("Please mount that partition before you try to backup to or restore from it."); 1776 popup_and_OK("Please mount that partition before you try to backup to or restore from it."); 1794 1777 finish(1); 1795 1778 } … … 2152 2135 fatal_error("I couldn't figure out the scratchdir!"); 2153 2136 } 2154 mr_asprintf(sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));2155 2137 mr_free(bkpinfo->scratchdir); 2156 bkpinfo->scratchdir = sz;2138 mr_asprintf(bkpinfo->scratchdir , "%s/mondo.scratch.%d", tmp, (int) (random() % 32768)); 2157 2139 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); 2158 2140 … … 2228 2210 2229 2211 assert(bkpinfo != NULL); 2230 // log_it("Asking what_number_cd_is_this");2212 // log_it("Asking what_number_cd_is_this"); 2231 2213 if (g_ISO_restore_mode) { 2232 2214 mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'"); 2233 2234 2215 mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER"); 2235 2216 cd_number = atoi(last_line_of_file(mountdev)); 2236 paranoid_free(mountdev);2237 paranoid_free(tmp);2217 mr_free(mountdev); 2218 mr_free(tmp); 2238 2219 2239 2220 return (cd_number); … … 2242 2223 mr_asprintf(mountdev, "%s", bkpinfo->media_device); 2243 2224 if (!mountdev[0]) { 2244 log_it 2245 ("(what_number_cd_is_this) Warning - media_device unknown. Finding out..."); 2225 log_it("(what_number_cd_is_this) Warning - media_device unknown. Finding out..."); 2246 2226 find_cdrom_device(bkpinfo->media_device, FALSE); 2247 2227 } … … 2253 2233 } 2254 2234 } 2255 paranoid_free(mountdev);2235 mr_free(mountdev); 2256 2236 2257 2237 cd_number = atoi(last_line_of_file(MNT_CDROM "/archives/THIS-CD-NUMBER"));
Note:
See TracChangeset
for help on using the changeset viewer.