Changeset 2383 in MondoRescue for branches/2.2.10
- Timestamp:
- Sep 10, 2009, 2:55:51 AM (16 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2382 r2383 539 539 if (bkpinfo->exclude_paths) { 540 540 mr_asprintf(tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths); 541 mr_asprintf(devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));541 devs_to_exclude = call_program_and_get_last_line_of_output(tmp); 542 542 mr_free(tmp); 543 543 … … 626 626 627 627 #ifdef __FreeBSD__ 628 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));628 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"); 629 629 if (!bootdev[0]) { 630 630 mr_free(bootdev); 631 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));631 bootdev = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"); 632 632 } 633 633 #else 634 634 /* Linux */ 635 635 #ifdef __IA64__ 636 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));636 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 637 637 #else 638 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));638 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 639 639 #endif 640 640 if (strstr(bootdev, "/dev/cciss/")) { 641 641 mr_free(bootdev); 642 642 #ifdef __IA64__ 643 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));643 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"); 644 644 #else 645 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));645 bootdev = call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"); 646 646 #endif 647 647 } 648 648 if (!bootdev[0]) { 649 649 mr_free(bootdev); 650 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));650 bootdev = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 651 651 if (strstr(bootdev, "/dev/cciss/")) { 652 652 mr_free(bootdev); 653 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));653 bootdev = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"); 654 654 } 655 655 } … … 928 928 log_to_screen("Mindi failed to create your boot+data disks."); 929 929 mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log"); 930 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));930 tmp = call_program_and_get_last_line_of_output(command); 931 931 mr_free(command); 932 932 … … 1185 1185 mr_asprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir); 1186 1186 1187 mr_asprintf(g_serial_string, "%s", call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1"));1187 g_serial_string = call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1"); 1188 1188 mr_strip_spaces(g_serial_string); 1189 1189 mr_strcat(g_serial_string, "...word."); … … 1892 1892 mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname); 1893 1893 log_msg(1, "command = '%s'", command); 1894 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));1894 tmp = call_program_and_get_last_line_of_output(command); 1895 1895 mr_free(command); 1896 1896 … … 2660 2660 mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname); 2661 2661 mr_free(our_serial_str); 2662 mr_asprintf(our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));2662 our_serial_str = call_program_and_get_last_line_of_output(tmp); 2663 2663 mr_free(tmp); 2664 2664 // FIXME - should be able to use last_line_of_file(), surely? … … 2859 2859 mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 2860 2860 log_it("command = %s", command); 2861 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));2861 tmp = call_program_and_get_last_line_of_output(command); 2862 2862 mr_free(command); 2863 2863 log_it("res of it = %s", tmp); -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2382 r2383 264 264 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l"); 265 265 log_msg(5, "Running: %s", command); 266 m r_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));266 mounted_file_system = call_program_and_get_last_line_of_output(command); 267 267 mr_free(command); 268 268 … … 274 274 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i); 275 275 log_msg(5, "Running: %s", command); 276 m r_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));276 mounted_file_system = call_program_and_get_last_line_of_output(command); 277 277 mr_free(command); 278 278 … … 333 333 int c = 0; 334 334 int lastpos = 0; 335 char VG[MAX_STR_LEN];335 char *VG = NULL; 336 336 char *tmp = NULL; 337 337 char *command = NULL; … … 358 358 mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf); 359 359 log_msg(5, " Executing: %s", command); 360 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));360 tmp = call_program_and_get_last_line_of_output(command); 361 361 mr_free(command); 362 362 … … 384 384 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 385 385 log_msg(4, "Executing: %s", command); 386 mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));386 partition_list = call_program_and_get_last_line_of_output(command); 387 387 mr_free(command); 388 388 log_msg(4, "Partition list for %s: %s", dsf, partition_list); … … 438 438 dsf, partitions[i]); 439 439 log_msg(4, " Running: %s", command); 440 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));440 tmp = call_program_and_get_last_line_of_output(command); 441 441 mr_free(command); 442 442 … … 451 451 /* It's not swap. See if we can find the mount point from the mount command. */ 452 452 mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]); 453 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));453 tmp = call_program_and_get_last_line_of_output(command); 454 454 mr_free(command); 455 455 … … 471 471 mr_asprintf(command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]); 472 472 log_msg(4, " Running: %s", command); 473 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));473 tmp = call_program_and_get_last_line_of_output(command); 474 474 mr_free(command); 475 475 if (strlen(tmp)) { … … 480 480 mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]); 481 481 log_msg(4, " Running: %s", command); 482 strcpy(VG, call_program_and_get_last_line_of_output(command));482 VG = call_program_and_get_last_line_of_output(command); 483 483 mr_free(command); 484 484 log_msg(4, " Volume Group: %s", VG); … … 488 488 mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 489 489 log_msg(4, " Running: %s", command); 490 m r_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));490 mount_list = call_program_and_get_last_line_of_output(command); 491 491 mr_free(command); 492 492 493 log_msg(4, " VG %s mount_list: %s", VG, mount_list); 493 494 lastpos = 0; … … 498 499 mr_free(tmp); 499 500 mr_free(token); 501 mr_free(VG); 500 502 return (1); 501 503 } … … 510 512 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 511 513 log_msg (5, "Running: %s", command); 512 m r_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));514 mount_list = call_program_and_get_last_line_of_output(command); 513 515 mr_free(command); 514 516 log_msg(4, " Software raid device list: %s", mount_list); … … 518 520 log_msg (5, "Running: %s", command); 519 521 mr_free(tmp); 520 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 522 523 tmp = call_program_and_get_last_line_of_output(command); 521 524 mr_free(command); 525 522 526 log_msg(4, "Number of Software raid device: %s", tmp); 523 527 if (atoi(tmp)) { … … 527 531 mr_free(tmp); 528 532 mr_free(token); 533 mr_free(VG); 529 534 return (1); 530 535 } … … 537 542 log_msg (4, "Error finding Volume Group for partition %s", partitions[i]); 538 543 mr_free(tmp); 544 mr_free(VG); 539 545 return (1); 540 546 } 541 547 mr_free(tmp); 548 mr_free(VG); 542 549 continue; 543 550 } … … 552 559 mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]); 553 560 log_msg(4, " Running: %s", command); 554 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));561 tmp = call_program_and_get_last_line_of_output(command); 555 562 mr_free(command); 556 563 if (!strlen(tmp)) { … … 563 570 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 564 571 log_msg (5, " Running: %s", command); 565 m r_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));572 mount_list = call_program_and_get_last_line_of_output(command); 566 573 mr_free(command); 567 574 log_msg(4, " Software raid device list: %s", mount_list); … … 572 579 log_msg(4, " Running: %s", command); 573 580 mr_free(tmp); 574 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));581 tmp = call_program_and_get_last_line_of_output(command); 575 582 mr_free(command); 576 583 if (!atoi(tmp)) { … … 1009 1016 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 1010 1017 mr_free(bkpinfo->isodir); 1011 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));1018 bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp1); 1012 1019 mr_free(tmp1); 1013 1020 … … 1027 1034 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 1028 1035 mr_free(bkpinfo->isodir); 1029 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));1036 bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp1); 1030 1037 mr_free(tmp1); 1031 1038 -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2382 r2383 525 525 if (tmp1) { 526 526 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe); 527 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));527 tmp = call_program_and_get_last_line_of_output(command); 528 528 mr_free(command); 529 529 } … … 805 805 806 806 log_msg(1, "command=%s", command); 807 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));807 tmp = call_program_and_get_last_line_of_output(command); 808 808 mr_free(command); 809 809 … … 833 833 } 834 834 835 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"));835 tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1"); 836 836 log_msg(5, "tmp = '%s'", tmp); 837 837 if (!tmp[0]) 838 838 mr_free(tmp); 839 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") 840 ); 839 tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1"); 841 840 if (tmp[0]) { 842 841 devno = atoi(tmp) - 1; … … 1097 1096 char *mddevice = (char *) malloc(32); 1098 1097 char command[MAX_STR_LEN]; 1098 char *tmp = NULL; 1099 1099 int vndev = 2; 1100 if (atoi 1101 (call_program_and_get_last_line_of_output 1102 ("/sbin/sysctl -n kern.osreldate")) < 500000) { 1100 int i = 2; 1101 1102 tmp = call_program_and_get_last_line_of_output("/sbin/sysctl -n kern.osreldate")); 1103 i = atoi(tmp); 1104 mr_free(tmp); 1105 1106 if (i < 500000) { 1103 1107 do { 1104 1108 sprintf(mddevice, "vn%ic", vndev++); … … 1133 1137 { 1134 1138 char *command = NULL; 1139 char *tmp = NULL; 1135 1140 int res = 0; 1141 int i = 0; 1136 1142 1137 1143 if (strncmp(dname, "/dev/", 5) == 0) { … … 1139 1145 } 1140 1146 1141 if (atoi 1142 (call_program_and_get_last_line_of_output 1143 ("/sbin/sysctl -n kern.osreldate")) < 500000) { 1147 tmp = call_program_and_get_last_line_of_output("/sbin/sysctl -n kern.osreldate")); 1148 i = atoi(tmp); 1149 mr_free(tmp); 1150 1151 if (i < 500000) { 1144 1152 mr_asprintf(command, "vnconfig -d %s", dname); 1145 1153 } else { … … 1653 1661 /* Initiate bkpinfo netfs_mount path from running environment if not already done */ 1654 1662 if (bkpinfo->netfs_mount == NULL) { 1655 mr_asprintf(bkpinfo->netfs_mount, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1"));1663 bkpinfo->netfs_mount = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1"); 1656 1664 } 1657 1665 #ifdef __FreeBSD__ … … 1682 1690 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->netfs_mount); 1683 1691 mr_free(bkpinfo->isodir); 1684 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(command));1692 bkpinfo->isodir = call_program_and_get_last_line_of_output(command); 1685 1693 mr_free(command); 1686 1694 … … 1722 1730 mr_free(bkpinfo->isodir); 1723 1731 if (is_this_device_mounted(bkpinfo->netfs_mount)) { 1724 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"));1732 bkpinfo->isodir = call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"); 1725 1733 1726 1734 } else { … … 1827 1835 #ifdef __FreeBSD__ 1828 1836 #define EXAMPLEBD "/dev/ad0" 1829 mr_asprintf(bkpinfo->boot_device, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));1837 bkpinfo->boot_device = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"); 1830 1838 #else 1831 1839 #define EXAMPLEBD "/dev/hda" 1832 mr_asprintf(bkpinfo->boot_device, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));1840 bkpinfo->boot_device = call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 1833 1841 #endif 1834 1842 i = which_boot_loader(bkpinfo->boot_device); … … 1887 1895 mr_free(tmp); 1888 1896 // NTFS 1889 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};'"));1897 tmp = call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"); 1890 1898 if (strlen(tmp) > 2) { 1891 1899 p = popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp); … … 2030 2038 2031 2039 mr_asprintf(exclude_these_directories,"%s",list_of_NETFS_mounts_only()); 2032 mr_asprintf(exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|sshfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));2040 exclude_these_devices = call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|sshfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"); 2033 2041 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2034 2042 mr_free(exclude_these_devices); … … 2051 2059 static char result_sz[512]; 2052 2060 2053 mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));2061 exclude_these_directories = call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"); 2054 2062 snprintf(result_sz, 511, "%s", exclude_these_directories); 2055 2063 mr_free(exclude_these_directories); … … 2103 2111 2104 2112 #ifdef __FreeBSD__ 2105 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 | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2113 tmp = 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 | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"); 2106 2114 #else 2107 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 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 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2115 tmp = call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -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 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"); 2108 2116 #endif 2109 2117 … … 2199 2207 if (g_ISO_restore_mode) { 2200 2208 mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'"); 2201 mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER"); 2209 mountdev = call_program_and_get_last_line_of_output(tmp); 2210 mr_strcat(mountdev, "/archives/THIS-CD-NUMBER"); 2202 2211 mr_free(tmp); 2203 2212 … … 2252 2261 2253 2262 #ifdef __FreeBSD__ 2254 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1"));2263 output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1"); 2255 2264 #else 2256 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | sed 's/[0-9]//' | sed 's/[0-9]//'"));2265 output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | sed 's/[0-9]//' | sed 's/[0-9]//'"); 2257 2266 if (strstr(output, "/dev/cciss/")) { 2258 2267 mr_free(output); 2259 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | cut -dp -f1"));2268 output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1 | cut -dp -f1"); 2260 2269 } 2261 2270 if (strstr(output, "/dev/md")) { 2262 2271 mr_free(output); 2263 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1"));2272 output = call_program_and_get_last_line_of_output("mount | grep ' on / ' | cut -d' ' -f1"); 2264 2273 } 2265 2274 #endif … … 2499 2508 log_msg(1, "curr_fname = %s", curr_fname); 2500 2509 mr_asprintf(command, "file %s", curr_fname); 2501 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));2510 tmp = call_program_and_get_last_line_of_output(command); 2502 2511 mr_free(command); 2503 2512 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; p--); … … 2550 2559 mr_free(fdisk); 2551 2560 2552 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));2561 tmp = call_program_and_get_last_line_of_output(command); 2553 2562 mr_free(command); 2554 2563 -
branches/2.2.10/mondo/src/common/libmondo-fifo.c
r2376 r2383 165 165 mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer); 166 166 log_msg(2, "kill_buffer() --- command = %s", command); 167 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));167 tmp = call_program_and_get_last_line_of_output(command); 168 168 mr_free(command); 169 169 -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2382 r2383 860 860 char *fname = NULL; 861 861 char *tmp = NULL; 862 char *tmp1 = NULL; 862 863 int pos_in_fname; 863 864 /*@ int ******************************************************** */ … … 877 878 mr_asprintf(tmp, "zcat %s | wc -l", filelist_fname); 878 879 log_msg(6, "tmp = %s", tmp); 879 lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp)); 880 881 tmp1 = call_program_and_get_last_line_of_output(tmp); 880 882 mr_free(tmp); 883 884 lines_in_filelist = atol(tmp1); 885 mr_free(tmp1); 881 886 882 887 if (lines_in_filelist < 3) { … … 1320 1325 char *new; 1321 1326 char *tmp = NULL; 1327 char *tmp1 = NULL; 1322 1328 char *dir = NULL; 1323 1329 static int percentage = 0; … … 1370 1376 1371 1377 mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist); 1372 g_skeleton_entries = 1 + atol(call_program_and_get_last_line_of_output(tmp));1378 tmp1 = call_program_and_get_last_line_of_output(tmp); 1373 1379 mr_free(tmp); 1380 1381 g_skeleton_entries = 1 + atol(tmp1); 1382 mr_free(tmp1); 1374 1383 1375 1384 mr_asprintf(name_of_evalcall_form, "Making catalog of %s", dir); … … 1533 1542 } 1534 1543 make_hole_for_file(sz_datefile); 1535 write_one_liner_data_file(sz_datefile,1536 call_program_and_get_last_line_of_output1537 ("date +%s"));1544 tmp1 = call_program_and_get_last_line_of_output("date +%s"); 1545 write_one_liner_data_file(sz_datefile, tmp1); 1546 mr_free(tmp1); 1538 1547 } else if (lstat(sz_datefile, &statbuf)) { 1539 1548 log_msg(2, "Warning - unable to find date of previous backup. Full backup instead."); … … 1560 1569 } 1561 1570 log_msg(1, "Calculating filelist"); 1562 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));1571 tmp2 = call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"); 1563 1572 if (strlen(tmp2) < 1) { 1564 1573 mr_asprintf(tmp1," "); … … 1567 1576 mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1568 1577 mr_free(tmp2); 1569 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));1578 tmp2 = call_program_and_get_last_line_of_output(tmp1); 1570 1579 log_msg(2, "Found windows files: %s",tmp2); 1571 1580 } -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2382 r2383 274 274 char *kernel = NULL;; 275 275 276 mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null"));276 kernel = call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null"); 277 277 278 278 // If we didn't get anything back, check whether mindi raised a fatal error 279 279 if (!kernel[0]) { 280 280 mr_asprintf(command, "%s", "grep 'Fatal error' /var/log/mindi.log"); 281 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));281 tmp = call_program_and_get_last_line_of_output(command); 282 282 if (strlen(tmp) > 1) { 283 283 popup_and_OK(tmp); … … 331 331 assert_string_is_neither_NULL_nor_zerolength(fname); 332 332 mr_asprintf(command, "which %s 2> /dev/null", fname); 333 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output(command));333 output = call_program_and_get_last_line_of_output(command); 334 334 mr_free(command); 335 335 if (output[0] == '\0') { … … 340 340 mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", output); 341 341 mr_free(output); 342 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output(command));342 output = call_program_and_get_last_line_of_output(command); 343 343 mr_free(command); 344 344 } … … 346 346 mr_asprintf(command, "dirname %s 2> /dev/null", output); 347 347 mr_free(output); 348 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output(command));348 output = call_program_and_get_last_line_of_output(command); 349 349 mr_free(command); 350 350 } … … 428 428 for (i = NOOF_ERR_LINES - 1; i >= 0 && !strstr(err_log_lines[i], "% Done") && !strstr(err_log_lines[i], "% done"); i--); 429 429 if (i < 0) { 430 mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');431 mr_asprintf(lastline, "%s", call_program_and_get_last_line_of_output(command));430 mr_asprintf(command, "tail -n3 %s | grep -Fi %% | tail -n1 | awk '{print $0;}'", filename); 431 lastline = call_program_and_get_last_line_of_output(command); 432 432 mr_free(command); 433 433 if (!lastline[0]) { … … 722 722 723 723 log_it(command); 724 mr_asprintf(sz_res, "%s", call_program_and_get_last_line_of_output(command));724 sz_res = call_program_and_get_last_line_of_output(command); 725 725 file_len_K = atol(sz_res); 726 726 log_msg(4, "%s --> %s --> %ld", command, sz_res, file_len_K); … … 779 779 mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname); 780 780 log_it("command = %s", command); 781 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));781 tmp = call_program_and_get_last_line_of_output(command); 782 782 mr_free(command); 783 783 … … 1030 1030 } 1031 1031 1032 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("which mondorestore"));1032 tmp = call_program_and_get_last_line_of_output("which mondorestore"); 1033 1033 if (!tmp[0]) { 1034 1034 mr_free(tmp); … … 1101 1101 /* BERLIOS : there is a bug #67 here as it only considers the first NIC */ 1102 1102 mr_asprintf(command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1103 mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command));1103 netfs_dev = call_program_and_get_last_line_of_output(command); 1104 1104 mr_free(command); 1105 1105 1106 1106 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2"); 1107 mr_asprintf(netfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));1107 netfs_client_ipaddr = call_program_and_get_last_line_of_output(command); 1108 1108 mr_free(command); 1109 1109 1110 1110 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2"); 1111 mr_asprintf(netfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));1111 netfs_client_netmask = call_program_and_get_last_line_of_output(command); 1112 1112 mr_free(command); 1113 1113 1114 1114 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2"); 1115 mr_asprintf(netfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));1115 netfs_client_broadcast = call_program_and_get_last_line_of_output(command); 1116 1116 mr_free(command); 1117 1117 1118 1118 mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'"); 1119 mr_asprintf(netfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));1119 netfs_client_defgw = call_program_and_get_last_line_of_output(command); 1120 1120 mr_free(command); 1121 1121 … … 1136 1136 log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", netfs_dev); 1137 1137 mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", netfs_dev); 1138 m r_asprintf(mac_addr, "%s", call_program_and_get_last_line_of_output(command));1138 mac_addr = call_program_and_get_last_line_of_output(command); 1139 1139 mr_free(command); 1140 1140 … … 1143 1143 mr_free(netfs_dev); 1144 1144 1145 mr_asprintf(netfs_dev, "%s", call_program_and_get_last_line_of_output(command));1145 netfs_dev = call_program_and_get_last_line_of_output(command); 1146 1146 mr_free(command); 1147 1147 -
branches/2.2.10/mondo/src/common/libmondo-fork.c
r2382 r2383 37 37 { 38 38 /*@ buffers ***************************************************** */ 39 static char result[512]; 40 char *tmp = NULL; 39 char *result = NULL; 41 40 42 41 /*@ pointers **************************************************** */ 43 42 FILE *fin; 44 43 45 /*@ initialize data ********************************************* */46 result[0] = '\0';47 48 44 /*@******************************************************************** */ 49 45 50 46 assert_string_is_neither_NULL_nor_zerolength(call); 51 47 if ((fin = popen(call, "r"))) { 52 for (mr_getline(tmp, fin); !feof(fin); mr_getline(tmp, fin)) { 53 if (strlen(tmp) > 1) { 54 strncpy(result, tmp, 511); 55 } 56 mr_free(tmp); 57 } 58 mr_free(tmp); 48 for (mr_getline(result, fin); !feof(fin); mr_getline(result, fin)); 59 49 paranoid_pclose(fin); 60 50 } else { 61 51 log_OS_error("Unable to popen call"); 62 52 } 63 strip_spaces(result);64 return 53 mr_strip_spaces(result); 54 return(result); 65 55 } 66 56 -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2376 r2383 265 265 266 266 mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe); 267 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));267 tmp = call_program_and_get_last_line_of_output(command); 268 268 mr_free(command); 269 269 … … 277 277 278 278 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe); 279 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));279 tmp = call_program_and_get_last_line_of_output(command); 280 280 mr_free(command); 281 281 … … 289 289 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe); 290 290 mr_free(cdr_exe); 291 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));291 tmp = call_program_and_get_last_line_of_output(command); 292 292 mr_free(command); 293 293 … … 324 324 } 325 325 326 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(" cdrecord -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'"));326 tmp = call_program_and_get_last_line_of_output(" cdrecord -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'"); 327 327 328 328 if (mt_says_tape_exists(dev)) { -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2382 r2383 225 225 d = 5.2; // :-) 226 226 #else 227 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("uname -r"));227 tmp = call_program_and_get_last_line_of_output("uname -r"); 228 228 p = strchr(tmp, '.'); 229 229 if (p) { … … 523 523 if (getenv ("SUDO_COMMAND")) { 524 524 mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND"); 525 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 525 tmp = call_program_and_get_last_line_of_output(command); 526 if (!strcmp(tmp, "1")) { 526 527 mr_free(command); 528 mr_free(tmp); 527 529 popup_and_OK("Fatal Error: Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 528 530 fatal_error("Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 529 531 } 530 532 mr_free(command); 533 mr_free(tmp); 531 534 } 532 535 log_msg(2, "call_make_iso (DVD res) is ... %s", bkpinfo->call_make_iso); … … 613 616 mr_asprintf(command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir); 614 617 log_it("command = %s", command); 615 log_it("res of it = %s", call_program_and_get_last_line_of_output(command));616 mr_asprintf(iso_dev, "%s", call_program_and_get_last_line_of_output(command));618 iso_dev = call_program_and_get_last_line_of_output(command); 619 log_it("res of it = %s", iso_dev); 617 620 mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir); 618 write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));621 write_one_liner_data_file(tmp, iso_dev); 619 622 mr_free(tmp); 620 623 mr_free(command); … … 624 627 625 628 log_it("command = %s", command); 626 log_it("res of it = %s", call_program_and_get_last_line_of_output(command));627 mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));629 iso_mnt = call_program_and_get_last_line_of_output(command); 630 log_it("res of it = %s", iso_mnt); 628 631 mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir); 629 write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));632 write_one_liner_data_file(tmp, iso_mnt); 630 633 mr_free(tmp); 631 634 mr_free(command); … … 899 902 900 903 mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4", partition); 901 mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command));904 out_sz = call_program_and_get_last_line_of_output(command); 902 905 mr_free(command); 903 906 … … 941 944 run_program_and_log_output("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE); 942 945 } 943 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));946 tmp = call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"); 944 947 if (atol(tmp) < 35000) { 945 948 retval++; … … 1014 1017 1015 1018 run_program_and_log_output("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5); 1016 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));1019 tmp = call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""); 1017 1020 if (strcmp("", tmp)) { 1018 1021 if (strstr(tmp, "autofs")) { … … 1104 1107 } else { 1105 1108 mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file); 1106 mr_asprintf(value, "%s", call_program_and_get_last_line_of_output(command));1109 value = call_program_and_get_last_line_of_output(command); 1107 1110 mr_free(command); 1108 1111 … … 1232 1235 mr_asprintf(command, "%s", "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[ ]/boot[ ]\" | tr -s ' ' '\t' | cut -f1 | head -n1"); 1233 1236 log_msg(4, "Cool. Command = '%s'", command); 1234 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));1237 tmp = call_program_and_get_last_line_of_output(command); 1235 1238 mr_free(command); 1236 1239 … … 1239 1242 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1240 1243 mr_free(tmp); 1241 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));1244 tmp = call_program_and_get_last_line_of_output(command); 1242 1245 mr_free(command); 1243 1246 … … 1439 1442 * The command used to start it is saved in @p g_magicdev_command. 1440 1443 */ 1441 void stop_magicdev_if_necessary() 1442 { 1443 strcpy(g_magicdev_command, 1444 call_program_and_get_last_line_of_output 1445 ("ps ax | grep -w magicdev | grep -v grep | tr -s '\t' ' '| cut -d' ' -f6-99")); 1444 void stop_magicdev_if_necessary() { 1445 1446 char *tmp = NULL; 1447 1448 tmp = call_program_and_get_last_line_of_output("ps ax | grep -w magicdev | grep -v grep | tr -s '\t' ' '| cut -d' ' -f6-99"); 1449 1450 strcpy(g_magicdev_command, tmp); 1451 mr_free(tmp); 1452 1446 1453 if (g_magicdev_command[0]) { 1447 1454 log_msg(1, "g_magicdev_command = '%s'", g_magicdev_command); -
branches/2.2.10/mondo/src/mondorestore/mondo-prep.c
r2376 r2383 336 336 if (lvmversion == 2) { 337 337 mr_asprintf(tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE); 338 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(tmp1));338 tmp = call_program_and_get_last_line_of_output(tmp1); 339 339 mr_free(tmp1); 340 340 } else { 341 341 mr_asprintf(tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE); 342 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(tmp1));342 tmp = call_program_and_get_last_line_of_output(tmp1); 343 343 mr_free(tmp1); 344 344 } … … 1414 1414 char *format = NULL; 1415 1415 char *tmp = NULL; 1416 char *tmp1 = NULL; 1416 1417 1417 1418 /** end *************************************************************/ … … 1578 1579 if (pout_to_fdisk) { 1579 1580 // mark relevant partition as bootable 1580 mr_asprintf(tmp, "a\n%s\n", call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy")); 1581 tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy"); 1582 mr_asprintf(tmp, "a\n%s\n", tmp1); 1583 mr_free(tmp1); 1584 1581 1585 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 1582 1586 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2382 r2383 756 756 } 757 757 758 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) { 758 tmp = call_program_and_get_last_line_of_output("cat " CMDLINE); 759 if (strstr(tmp, "pxe")) { 759 760 /* We need to override prefix value in PXE mode as it's 760 761 * already done in start-netfs */ … … 766 767 mr_asprintf(bkpinfo->prefix, "%s", envtmp1); 767 768 } 769 mr_free(tmp); 768 770 769 771 } else if (!strcmp(value, "tape")) { … … 939 941 940 942 tmp = read_cfg_var(g_mondo_cfg_file, "please-dont-eject"); 941 if (tmp || strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "donteject")) { 943 tmp1 = call_program_and_get_last_line_of_output("cat " CMDLINE); 944 if (tmp || strstr(tmp1, "donteject")) { 942 945 bkpinfo->please_dont_eject = TRUE; 943 946 log_msg(2, "Ok, I shan't eject when restoring! Groovy."); 944 947 } 945 948 mr_free(tmp); 949 mr_free(tmp1); 946 950 947 951 if (bkpinfo->backup_media_type == netfs) { … … 971 975 } 972 976 } 973 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "pxe")) { 977 tmp1 = call_program_and_get_last_line_of_output("cat " CMDLINE); 978 if (strstr(tmp1, "pxe")) { 979 mr_free(tmp1); 974 980 /* We need to override values in PXE mode as it's 975 981 * already done in start-netfs */ … … 987 993 mr_free(bkpinfo->netfs_remote_dir); 988 994 mr_asprintf(bkpinfo->netfs_remote_dir, "%s", envtmp2); 989 } 995 } else { 996 mr_free(tmp1); 997 } 998 990 999 } else if (bkpinfo->backup_media_type == iso) { 991 1000 /* Patch by Conor Daly 23-june-2004 … … 1025 1034 mr_asprintf(command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device); 1026 1035 log_it("command = %s", command); 1027 log_it("res of it = %s", call_program_and_get_last_line_of_output(command));1028 mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));1036 iso_mnt = call_program_and_get_last_line_of_output(command); 1037 log_it("res of it = %s", iso_mnt); 1029 1038 mr_free(command); 1030 1039 } else { … … 2174 2183 char *mounted_cfgf_path; 2175 2184 char *tmp = NULL; 2185 char *tmp1 = NULL; 2176 2186 char *mountpt = NULL; 2177 2187 char *ramdisk_fname; … … 2290 2300 if (does_file_exist(MONDO_CFG_FILE_STUB)) { 2291 2301 log_msg(1, "gcffa --- great! We've got the config file"); 2292 mr_asprintf(tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB); 2302 tmp = call_program_and_get_last_line_of_output("pwd"); 2303 mr_strcat(tmp, "/%s", MONDO_CFG_FILE_STUB); 2293 2304 mr_asprintf(command, "cp -f %s %s", tmp, cfg_file); 2294 2305 log_it("%s",command); … … 2300 2311 mr_free(command); 2301 2312 2302 mr_asprintf(command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"), 2303 MOUNTLIST_FNAME_STUB, mountlist_file); 2313 tmp1 = call_program_and_get_last_line_of_output("pwd"); 2314 mr_asprintf(command, "cp -f %s/%s %s", tmp1, MOUNTLIST_FNAME_STUB, mountlist_file); 2315 mr_free(tmp1); 2316 2304 2317 log_it("%s",command); 2305 2318 if (extract_mountlist_stub) { -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2382 r2383 470 470 log_it("Done loading config file; resizing ML"); 471 471 472 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "noresize")) { 472 tmp1 = call_program_and_get_last_line_of_output("cat " CMDLINE); 473 if (strstr(tmp1, "noresize")) { 473 474 log_msg(1, "Not resizing mountlist."); 474 475 } else { 475 476 resize_mountlist_proportionately_to_suit_new_drives(mountlist); 476 477 } 478 mr_free(tmp1); 479 477 480 for (done = FALSE; !done;) { 478 481 log_it("About to edit mountlist"); … … 750 753 int res = 0; 751 754 bool boot_loader_installed = FALSE; 752 /** malloc **/753 755 char *tmp = NULL; 756 char *tmp1 = NULL; 754 757 char *flaws_str = NULL; 755 758 … … 762 765 get_cfg_file_from_archive_or_bust(); 763 766 load_mountlist(mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo updated the mountlist 764 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "noresize")) { 767 768 tmp = call_program_and_get_last_line_of_output("cat " CMDLINE); 769 if (strstr(tmp, "noresize")) { 765 770 log_msg(2, "Not resizing mountlist."); 766 771 } else { 767 772 resize_mountlist_proportionately_to_suit_new_drives(mountlist); 768 773 } 774 mr_free(tmp); 775 769 776 flaws_str = evaluate_mountlist(mountlist, &res); 770 777 if (!res) { … … 795 802 twenty_seconds_til_yikes(); 796 803 g_fprep = fopen("/tmp/prep.sh", "w"); 797 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "nopart")) {798 log_msg(2,799 804 tmp = call_program_and_get_last_line_of_output("cat " CMDLINE); 805 if (strstr(tmp, "nopart")) { 806 log_msg(2, "Not partitioning drives due to 'nopart' option."); 800 807 res = 0; 801 808 } else { 802 809 res = partition_everything(mountlist); 803 810 if (res) { 804 log_to_screen 805 ("Warning. Errors occurred during partitioning."); 811 log_to_screen("Warning. Errors occurred during partitioning."); 806 812 res = 0; 807 813 } 808 814 } 815 mr_free(tmp); 816 809 817 retval += res; 810 818 if (!res) { … … 867 875 868 876 after_the_nuke: 877 tmp1 = call_program_and_get_last_line_of_output("cat " CMDLINE); 869 878 if (retval) { 870 879 log_to_screen("Errors occurred during the nuke phase."); 871 } else if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "RESTORE")) { 872 log_to_screen 873 ("PC was restored successfully. Thank you for using Mondo Rescue."); 874 log_to_screen 875 ("Please visit our website at http://www.mondorescue.org for more information."); 880 } else if (tmp1, "RESTORE")) { 881 log_to_screen("PC was restored successfully. Thank you for using Mondo Rescue."); 882 log_to_screen("Please visit our website at http://www.mondorescue.org for more information."); 876 883 } else { 877 884 mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); … … 882 889 log_to_screen("Please visit our website at http://www.mondorescue.org for more information."); 883 890 } 891 mr_free(tmp1); 892 884 893 g_I_have_just_nuked = TRUE; 885 894 return (retval); … … 2618 2627 /* Configure global variables */ 2619 2628 malloc_libmondo_global_strings(); 2620 if (strstr(call_program_and_get_last_line_of_output("cat " CMDLINE), "textonly"))2621 {2629 tmp1 = call_program_and_get_last_line_of_output("cat " CMDLINE); 2630 if (strstr(tmp1, "textonly")) { 2622 2631 g_text_mode = TRUE; 2623 2632 log_msg(1, "TEXTONLY MODE"); … … 2625 2634 g_text_mode = FALSE; 2626 2635 } // newt :-) 2636 mr_free(tmp1); 2627 2637 2628 2638 /* Init GUI */ 2629 2639 setup_newt_stuff(); /* call newtInit and setup screen log */ 2630 2640 2631 strcpy(g_mondo_home, call_program_and_get_last_line_of_output("which mondorestore")); 2641 tmp1 = call_program_and_get_last_line_of_output("which mondorestore"); 2642 strcpy(g_mondo_home, tmp1); 2643 mr_free(tmp1); 2644 2632 2645 g_current_media_number = 1; // precaution 2633 2646
Note:
See TracChangeset
for help on using the changeset viewer.