Changeset 1106 in MondoRescue for trunk/mondo
- Timestamp:
- Feb 7, 2007, 11:55:11 PM (17 years ago)
- Location:
- trunk/mondo/src
- Files:
-
- 30 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/src/common/libmondo-archive.c
r1086 r1106 20 20 #include "mr_mem.h" 21 21 #include "mr_err.h" 22 #include "mr_str.h" 23 #include "mr_file.h" 22 24 23 25 #include "libmondo-string-EXT.h" … … 544 546 /*@ buffer ************************************************************ */ 545 547 char *tmp = NULL; 546 char *tmp1 = NULL;547 char *tmp2 = NULL;548 548 char *command = NULL; 549 549 char *use_lzo_sz = NULL; … … 559 559 char *devs_to_exclude = NULL; 560 560 char *use_lilo_sz = NULL; 561 char *value = NULL;562 561 char *bootdev = NULL; 563 564 562 565 563 /*@ char ************************************************************** */ … … 572 570 int res = 0; 573 571 long estimated_total_noof_slices = 0; 572 573 FILE *fd = NULL; 574 FILE *fd1 = NULL; 574 575 575 576 assert(bkpinfo != NULL); … … 606 607 mr_asprintf(&tape_device, " "); 607 608 } 609 /* BERLIOS: This parameter is not used after? */ 610 mr_free(tape_size_sz); 608 611 if (bkpinfo->use_lzo) { 609 612 mr_asprintf(&use_lzo_sz, "yes"); … … 759 762 mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir); 760 763 if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) { 761 mr_msg(1, "%ld: Unable to write one-liner boot device", __LINE__); 762 } 763 mr_free(tmp); 764 /* BERLIOS: Use bkptype_to_string without LANG */ 765 switch (bkpinfo->backup_media_type) { 766 case cdr: 767 mr_asprintf(&value, "cdr"); 768 break; 769 case cdrw: 770 mr_asprintf(&value, "cdrw"); 771 break; 772 case cdstream: 773 mr_asprintf(&value, "cdstream"); 774 break; 775 case tape: 776 mr_asprintf(&value, "tape"); 777 break; 778 case udev: 779 mr_asprintf(&value, "udev"); 780 break; 781 case iso: 782 mr_asprintf(&value, "iso"); 783 break; 784 case nfs: 785 mr_asprintf(&value, "nfs"); 786 break; 787 case dvd: 788 mr_asprintf(&value, "dvd"); 789 break; 790 case usb: 791 strcpy(value, "usb"); 792 break; 793 default: 794 fatal_error("Unknown backup_media_type"); 795 } 796 mr_asprintf(&tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir); 797 if (write_one_liner_data_file(tmp, value)) { 798 res++; 799 mr_msg(1, "%ld: Unable to write one-liner backup-media-type", 800 __LINE__); 801 } 802 mr_free(value); 803 mr_free(tmp); 804 log_to_screen(bkpinfo->tmpdir); 805 mr_asprintf(&tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir); 806 if (write_one_liner_data_file(tmp, bootldr_str)) { 807 res++; 808 mr_msg(1, "%ld: Unable to write one-liner bootloader.name", 809 __LINE__); 810 } 811 mr_free(bootldr_str); 812 mr_free(tmp); 813 mr_asprintf(&tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir); 814 if (bkpinfo->differential) { 815 res += write_one_liner_data_file(tmp, "1"); 816 } else { 817 res += write_one_liner_data_file(tmp, "0"); 818 } 819 mr_free(tmp); 820 821 if (g_getfattr) { 822 mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir); 823 if (write_one_liner_data_file(tmp1, "TRUE")) { 824 mr_msg(1, "%ld: Unable to write one-liner XATTR", 825 __LINE__); 826 } 827 mr_free(tmp1); 828 } 829 if (g_getfacl) { 830 mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir); 831 if (write_one_liner_data_file(tmp1, "TRUE")) { 832 mr_msg(1, "%ld: Unable to write one-liner ACL", 833 __LINE__); 834 } 835 mr_free(tmp1); 764 mr_msg(1, "Unable to write one-liner boot device"); 765 836 766 } 837 767 … … 850 780 log_OS_error("Unable to make mnt floppy directory"); 851 781 } 782 783 /* Prepare interface with mindi through a configuration file 784 * under /var/cache/mondo by default 785 * and the mondorestore configuration file at the same time that 786 * will be included by mindi on the initrd */ 787 788 fd = mr_fopen(MONDO_CACHE"/mindi.conf", "w"); 789 fd1 = mr_fopen(MONDORESTORECFG, "a"); 790 791 mr_fprintf(fd, "mindi_kernel=%s\n", bkpinfo->kernel_path); 792 mr_fprintf(fd, "mindi_use_own_kernel=yes\n"); 793 794 mr_fprintf(fd1, "files-in-filelist %ld\n", lines_in_filelist); 795 mr_fprintf(fd1, "internal-tape-block-size %ld\n", bkpinfo->internal_tape_block_size); 796 mr_fprintf(fd1, "total-slices %ld\n", estimated_total_noof_slices); 797 mr_fprintf(fd1, "excluded-devs %s\n", devs_to_exclude); 798 mr_free(devs_to_exclude); 799 mr_fprintf(fd1, "image-devs %s\n", bkpinfo->image_devs); 800 mr_fprintf(fd1, "last-filelist-number %s\n", last_filelist_number); 801 mr_free(last_filelist_number); 802 mr_fprintf(fd1, "bootloader.name %s\n", bootldr_str); 803 mr_free(bootldr_str); 804 mr_fprintf(fd1, "bootloader.device %s\n", bkpinfo->boot_device); 805 806 switch (bkpinfo->backup_media_type) { 807 case cdr: 808 mr_fprintf(fd1, "backup-media-type cdr\n"); 809 break; 810 case cdrw: 811 mr_fprintf(fd1, "backup-media-type cdrw\n"); 812 break; 813 case cdstream: 814 mr_fprintf(fd1, "backup-media-type cdstream\n"); 815 break; 816 case tape: 817 mr_fprintf(fd1, "backup-media-type tape\n"); 818 break; 819 case udev: 820 mr_fprintf(fd1, "backup-media-type udev\n"); 821 break; 822 case iso: 823 mr_fprintf(fd1, "backup-media-type iso\n"); 824 break; 825 case nfs: 826 mr_fprintf(fd1, "backup-media-type nfs\n"); 827 break; 828 case dvd: 829 mr_fprintf(fd1, "backup-media-type dvd\n"); 830 break; 831 case usb: 832 mr_fprintf(fd1, "backup-media-type usb\n"); 833 break; 834 default: 835 fatal_error("Unknown backup_media_type"); 836 } 837 838 if (bkpinfo->backup_media_type == usb) { 839 mr_fprintf(fd, "mindi_write_usb=yes\n"); 840 mr_fprintf(fd, "mindi_usb_device=%s\n", bkpinfo->media_device); 841 } 842 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 843 mr_fprintf(fd, "mindi_write_tape=yes\n"); 844 mr_fprintf(fd, "mindi_tape_device=%s\n", bkpinfo->media_device); 845 mr_fprintf(fd1, "media-dev %s\n", bkpinfo->media_device); 846 mr_fprintf(fd1, "media-size %ld\n", bkpinfo->media_size[1]); 847 } 848 if (bkpinfo->compression_level > 0) { 849 mr_fprintf(fd1, "use-comp yes\n"); 850 } else { 851 mr_fprintf(fd1, "use-comp no\n"); 852 } 853 if (bkpinfo->use_gzip) { 854 mr_fprintf(fd1, "use-gzip yes\n"); 855 } else { 856 mr_fprintf(fd1, "use-gzip no\n"); 857 } 858 if (bkpinfo->use_lzo) { 859 mr_fprintf(fd1, "use-lzo yes\n"); 860 } else { 861 mr_fprintf(fd1, "use-lzo no\n"); 862 } 863 if (bkpinfo->use_star) { 864 mr_fprintf(fd1, "use-star yes\n"); 865 } else { 866 mr_fprintf(fd1, "use-star no\n"); 867 } 868 if (g_getfattr) { 869 mr_fprintf(fd1, "xattr yes\n"); 870 } else { 871 mr_fprintf(fd1, "xattr no\n"); 872 } 873 if (g_getfacl) { 874 mr_fprintf(fd1, "acl yes\n"); 875 } else { 876 mr_fprintf(fd1, "acl no\n"); 877 } 878 879 if (g_cd_recovery) { 880 mr_fprintf(fd1, "use-cdrecovery yes\n"); 881 } else { 882 mr_fprintf(fd1, "use-cdrecovery no\n"); 883 } 884 885 if (bkpinfo->make_cd_use_lilo) { 886 mr_fprintf(fd1, "use-lilo yes\n"); 887 } else { 888 mr_fprintf(fd1, "use-lilo no\n"); 889 } 890 if (bkpinfo->nonbootable_backup) { 891 mr_fprintf(fd1, "non-bootable yes\n"); 892 } else { 893 mr_fprintf(fd1, "non-bootable no\n"); 894 } 895 if (bkpinfo->differential) { 896 mr_fprintf(fd1, "differential 1\n"); 897 } else { 898 mr_fprintf(fd1, "differential 0\n"); 899 } 900 901 mr_fclose(fd); 902 mr_fprintf(fd1, "datestamp %s\n", mr_date()); 903 mr_fclose(fd1); 904 905 mr_asprintf(&command, "mindi --custom '%s' '%s/images'", 906 bkpinfo->tmpdir, bkpinfo->scratchdir); 907 //bkpinfo->tmpdir, // parameter #2 908 //bkpinfo->scratchdir, // parameter #3 909 //bkpinfo->kernel_path, // parameter #4 910 //tape_device, // parameter #5 911 //tape_size_sz, // parameter #6 912 //lines_in_filelist, // parameter #7 (INT) 913 //use_lzo_sz, // parameter #8 914 //cd_recovery_sz, // parameter #9 915 //bkpinfo->image_devs, // parameter #10 916 //broken_bios_sz, // parameter #11 always yes 917 //last_filelist_number, // parameter #12 (STRING) 918 //estimated_total_noof_slices, // parameter #13 (INT) 919 //devs_to_exclude, // parameter #14 920 //use_comp_sz, // parameter #15 921 //use_lilo_sz, // parameter #16 922 //use_star_sz, // parameter #17 923 //bkpinfo->internal_tape_block_size, // parameter #18 (LONG) 924 //bkpinfo->differential, // parameter #19 (INT) 925 //use_gzip_sz); // parameter #20 (STRING) 926 927 mr_msg(2, command); 928 929 930 res = run_program_and_log_to_screen(command, "Generating boot+data disks"); 852 931 mr_free(command); 853 854 mr_asprintf(&tmp, "BTW, I'm telling Mindi your kernel is '%s'",855 bkpinfo->kernel_path);856 log_to_screen(tmp);857 mr_free(tmp);858 859 mr_msg(1, "lines_in_filelist = %ld", lines_in_filelist);860 861 if (bkpinfo->backup_media_type == usb) {862 mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);863 } else {864 mr_asprintf(&tmp2,"");865 }866 867 // Watch it! This next line adds a parameter...868 if (bkpinfo->nonbootable_backup) {869 mr_asprintf(&tmp, " NONBOOTABLE");870 } else {871 mr_asprintf(&tmp, " ");872 }873 874 mr_asprintf(&command,875 "mindi %s --custom '%s' '%s/images' '%s' '%s' \876 '%s' %ld '%s' '%s' '%s' \877 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'",878 tmp2,879 bkpinfo->tmpdir, // parameter #2880 bkpinfo->scratchdir, // parameter #3881 bkpinfo->kernel_path, // parameter #4882 tape_device, // parameter #5883 tape_size_sz, // parameter #6884 lines_in_filelist, // parameter #7 (INT)885 use_lzo_sz, // parameter #8886 cd_recovery_sz, // parameter #9887 bkpinfo->image_devs, // parameter #10888 broken_bios_sz, // parameter #11889 last_filelist_number, // parameter #12 (STRING)890 estimated_total_noof_slices, // parameter #13 (INT)891 devs_to_exclude, // parameter #14892 use_comp_sz, // parameter #15893 use_lilo_sz, // parameter #16894 use_star_sz, // parameter #17895 bkpinfo->internal_tape_block_size, // parameter #18 (LONG)896 bkpinfo->differential, // parameter #19 (INT)897 use_gzip_sz, // parameter #20 (STRING)898 tmp);899 mr_free(tmp);900 mr_free(tape_size_sz);901 mr_free(use_lzo_sz);902 mr_free(tape_device);903 mr_free(use_star_sz);904 mr_free(use_comp_sz);905 mr_free(broken_bios_sz);906 mr_free(cd_recovery_sz);907 mr_free(last_filelist_number);908 mr_free(devs_to_exclude);909 mr_free(use_lilo_sz);910 mr_free(use_gzip_sz);911 mr_free(tmp2);912 913 mr_msg(2, command);914 915 // popup_and_OK("Pausing");916 res = run_program_and_log_to_screen(command,917 "Generating boot+data disks");918 mr_free(command);919 920 932 if (bkpinfo->nonbootable_backup) { 921 933 res = 0; … … 1176 1188 closeout_tape(bkpinfo); 1177 1189 } else { 1178 /* write final ISO */1190 /* write final ISO/USB */ 1179 1191 res = write_final_iso_if_necessary(bkpinfo); 1180 1192 retval += res; … … 1868 1880 if (bkpinfo->nonbootable_backup) { 1869 1881 mr_msg(1, "Making nonbootable backup"); 1870 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end1871 1882 res = eval_call_to_make_ISO(bkpinfo, 1872 1883 "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", … … 3563 3574 bkpinfo->media_size[g_current_media_number]) { 3564 3575 mr_asprintf(&tmp, 3565 "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", 3566 (long) space_occupied_by_cd(bkpinfo->scratchdir), 3567 (long) bkpinfo->media_size[g_current_media_number]); 3576 "Warning! %s is too big. It occupies %ld KB, which is more than the %ld KB allowed.", 3577 media_descriptor_string(bkpinfo->backup_media_type), 3578 (long) space_occupied_by_cd(bkpinfo->scratchdir), 3579 (long) bkpinfo->media_size[g_current_media_number]); 3568 3580 log_to_screen(tmp); 3569 3581 mr_free(tmp); 3570 3582 } 3571 mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, 3572 bkpinfo->nfs_remote_dir, bkpinfo->prefix, 3573 g_current_media_number); 3583 if (bkpinfo->backup_media_type != usb) { 3584 mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, 3585 bkpinfo->nfs_remote_dir, bkpinfo->prefix, 3586 g_current_media_number); 3587 } else { 3588 } 3574 3589 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3575 res = make_iso_fs(bkpinfo, isofile); 3590 if (bkpinfo->backup_media_type != usb) { 3591 res = make_iso_fs(bkpinfo, isofile); 3592 } else { 3593 } 3576 3594 if (g_current_media_number == 1 && !res 3577 3595 && (bkpinfo->backup_media_type == cdr … … 3854 3872 3855 3873 setenv("MONDO_SHARE", MONDO_SHARE, 1); 3874 setenv("MONDORESTORECFG", MONDORESTORECFG, 1); 3875 setenv("MONDO_CACHE", MONDO_CACHE, 1); 3856 3876 } 3857 3877 -
trunk/mondo/src/common/libmondo-devices.h
r783 r1106 2 2 * $Id$ 3 3 */ 4 5 #ifndef LIBMONDO_DEVICES_H 6 # define LIBMONDO_DEVICES_H 4 7 5 8 bool am_I_in_disaster_recovery_mode(void); … … 36 39 int eject_device(char *); 37 40 38 char *list_of_NFS_mounts_only( );41 char *list_of_NFS_mounts_only(void); 39 42 40 43 void sensibly_set_tmpdir_and_scratchdir(struct s_bkpinfo *bkpinfo); … … 57 60 char *which_partition_format(const char *drive); 58 61 char *bkptype_to_string(t_bkptype bt); 62 63 #endif /* LIBMONDO_DEVICES_H */ -
trunk/mondo/src/common/libmondo-fifo-EXT.h
r59 r1106 4 4 long internal_block_size); 5 5 extern void sigpipe_occurred(int); 6 extern void kill_buffer( );6 extern void kill_buffer(void); -
trunk/mondo/src/common/libmondo-filelist.c
r1086 r1106 395 395 396 396 397 int call_exe_and_pipe_output_to_fd(char *sys call, FILE * pout)397 int call_exe_and_pipe_output_to_fd(char *sys_call, FILE * pout) 398 398 { 399 399 FILE *pattr; … … 401 401 size_t n = 0; 402 402 403 pattr = popen(sys call, "r");403 pattr = popen(sys_call, "r"); 404 404 if (!pattr) { 405 mr_msg(1, "Failed to open fattr() %s", sys call);405 mr_msg(1, "Failed to open fattr() %s", sys_call); 406 406 return (1); 407 407 } 408 408 if (feof(pattr)) { 409 mr_msg(1, "Failed to call fattr() %s", sys call);409 mr_msg(1, "Failed to call fattr() %s", sys_call); 410 410 paranoid_pclose(pattr); 411 411 return (2); … … 426 426 FILE *pout; 427 427 char *pout_command; 428 char *sys call;428 char *sys_call; 429 429 char *file_to_analyze = NULL; 430 430 char *strtmp = NULL; … … 454 454 /* BERLIOS : to be checked */ 455 455 mr_asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\')); 456 mr_asprintf(&sys call, "%s 2>> /dev/null", strtmp);456 mr_asprintf(&sys_call, "%s 2>> /dev/null", strtmp); 457 457 mr_free(strtmp); 458 call_exe_and_pipe_output_to_fd(sys call, pout);459 mr_free(sys call);458 call_exe_and_pipe_output_to_fd(sys_call, pout); 459 mr_free(sys_call); 460 460 } 461 461 paranoid_fclose(fin); -
trunk/mondo/src/common/libmondo-files.c
r1086 r1106 19 19 #include "libmondo-string-EXT.h" 20 20 #include "mr_mem.h" 21 22 #include "mr_file.h" 21 23 22 24 /*@unused@*/ … … 1044 1046 char *command = NULL; 1045 1047 1048 FILE *fd1 = NULL; 1049 1046 1050 /*@ pointers ***** */ 1047 1051 char *p; … … 1096 1100 ("Unable to find ethN (eth0, eth1, ...) adapter via NFS mount you specified."); 1097 1101 } 1098 make_hole_for_dir("/var/cache/mondo-archive");1099 1102 /******** 1100 1103 * If the NFS device that found above is a bonded device, … … 1121 1124 } 1122 1125 1123 mr_asprintf(&tmp, "%s/NFS-DEV", bkpinfo->tmpdir);1124 write_one_liner_data_file(tmp, nfs_dev);1125 1126 mr_free(nfs_dev); 1126 1127 mr_free(tmp); 1127 1128 1128 mr_asprintf(&tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1129 write_one_liner_data_file(tmp, nfs_client_ipaddr); 1130 mr_free(nfs_client_ipaddr); 1131 mr_free(tmp); 1132 1133 mr_asprintf(&tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1134 write_one_liner_data_file(tmp, nfs_client_netmask); 1135 mr_free(nfs_client_netmask); 1136 mr_free(tmp); 1137 1138 mr_asprintf(&tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1139 write_one_liner_data_file(tmp, nfs_client_defgw); 1140 mr_free(nfs_client_defgw); 1141 mr_free(tmp); 1142 1143 mr_asprintf(&tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir); 1144 write_one_liner_data_file(tmp, nfs_client_broadcast); 1145 mr_free(nfs_client_broadcast); 1146 mr_free(tmp); 1147 1148 mr_asprintf(&tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir); 1149 write_one_liner_data_file(tmp, nfs_server_ipaddr); 1150 mr_free(nfs_server_ipaddr); 1151 mr_free(tmp); 1152 1153 mr_asprintf(&tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir); 1154 write_one_liner_data_file(tmp, bkpinfo->nfs_mount); 1155 mr_free(tmp); 1156 1157 mr_asprintf(&tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir); 1158 write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir); 1159 mr_free(tmp); 1160 1161 mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 1162 write_one_liner_data_file(tmp, bkpinfo->prefix); 1163 mr_free(tmp); 1129 fd1 = mr_fopen(MONDORESTORECFG, "a"); 1130 mr_fprintf(fd1, "nfs-dev %s\n", nfs_dev); 1131 mr_fprintf(fd1, "nfs-client-ipaddr %s\n", nfs_client_ipaddr); 1132 mr_fprintf(fd1, "nfs-client-netmask %s\n", nfs_client_netmask); 1133 mr_fprintf(fd1, "nfs-client-broadcast %s\n", nfs_client_broadcast); 1134 mr_fprintf(fd1, "nfs-client-defgw %s\n", nfs_client_defgw); 1135 mr_fprintf(fd1, "nfs-server-ipaddr %s\n", nfs_server_ipaddr); 1136 mr_fprintf(fd1, "nfs-server-mount %s\n", bkpinfo->nfs_mount); 1137 mr_fprintf(fd1, "nfs-server-path %s\n", bkpinfo->nfs_remote_dir); 1138 mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix); 1139 mr_fclose(fd1); 1164 1140 1165 1141 log_it("Finished storing NFS configuration"); -
trunk/mondo/src/common/libmondo-raid.c
r1086 r1106 214 214 */ 215 215 void add_disk_to_raid_device(struct list_of_disks *disklist, 216 char *device_to_add, int i ndex)216 char *device_to_add, int idx) 217 217 { 218 218 int items; … … 222 222 items = disklist->entries; 223 223 strcpy(disklist->el[items].device, device_to_add); 224 disklist->el[items].index = i ndex;224 disklist->el[items].index = idx; 225 225 items++; 226 226 disklist->entries = items; … … 652 652 653 653 struct list_of_disks *disklist = NULL; 654 int index = 0;655 654 int v = 0; 656 655 … … 708 707 mr_free(tmp); 709 708 } else { 710 index = atoi(valueB); 711 add_disk_to_raid_device(disklist, value, index); 709 add_disk_to_raid_device(disklist, value, atoi(valueB)); 712 710 } 713 711 mr_free(labelB); -
trunk/mondo/src/common/libmondo-tools-EXT.h
r171 r1106 1 /* libmondo-tools-EXT.h */ 1 /* $Id$ */ 2 3 #ifndef LIBMONDO_TOOLS_EXT_H 4 #define LIBMONDO_TOOLS_EXT_H 2 5 3 6 extern void clean_up_KDE_desktop_if_necessary(void); 4 extern long get_time( );7 extern long get_time(void); 5 8 extern void (*log_debug_msg) (int debug_level, const char *szFile, 6 9 const char *szFunction, int nLine, … … 17 20 extern void initialize_raidrec(struct raid_device_record *raidrec); 18 21 #endif 19 extern int some_basic_system_sanity_checks( );22 extern int some_basic_system_sanity_checks(void); 20 23 21 24 … … 40 43 extern void free_libmondo_global_strings(void); 41 44 42 extern double get_kernel_version( );43 extern char *get_architecture( );45 extern double get_kernel_version(void); 46 extern char *get_architecture(void); 44 47 45 48 extern bool does_nonMS_partition_exist(void); … … 48 51 extern void stop_magicdev_if_necessary(void); 49 52 extern void restart_magicdev_if_necessary(void); 53 54 #endif /* LIBMONDO_TOOLS_EXT_H */ -
trunk/mondo/src/common/libmondo-tools.c
r1086 r1106 10 10 #include "my-stuff.h" 11 11 #include "mr_mem.h" 12 #include "mr_file.h" 13 12 14 #include "mondostructures.h" 13 15 #include "libmondo-tools.h" … … 362 364 int rdsiz_MB; 363 365 char *iso_path = NULL; 366 FILE *fd1 = NULL; 364 367 365 368 assert(bkpinfo != NULL); … … 592 595 bkpinfo->isodir); 593 596 log_it("command = %s", command); 594 tmp= call_program_and_get_last_line_of_output(command);597 iso_dev = call_program_and_get_last_line_of_output(command); 595 598 mr_free(command); 596 log_it("res of it = %s", tmp);597 mr_asprintf(&tmp1, "%s/ISO-DEV", bkpinfo->tmpdir); 598 write_one_liner_data_file(tmp1, tmp);599 mr_f ree(tmp1);599 log_it("res of it = %s", iso_dev); 600 601 fd1 = mr_fopen(MONDORESTORECFG, "a"); 602 mr_fprintf(fd1, "iso-dev %s\n", iso_dev); 600 603 601 604 mr_asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", 602 tmp); 603 mr_free(tmp); 605 iso_dev); 606 mr_free(iso_dev); 607 604 608 log_it("command = %s", command); 605 tmp= call_program_and_get_last_line_of_output(command);609 iso_mnt = call_program_and_get_last_line_of_output(command); 606 610 mr_free(command); 607 log_it("res of it = %s", tmp); 608 609 mr_asprintf(&tmp1, "%s/ISO-MNT", bkpinfo->tmpdir); 610 write_one_liner_data_file(tmp1, tmp); 611 mr_free(tmp1); 612 613 log_it("isomnt: %s, %d", tmp, strlen(tmp)); 614 if (strlen(bkpinfo->isodir) < strlen(tmp)) { 615 mr_asprintf(&iso_path, " "); 616 } else { 617 mr_asprintf(&iso_path, "%s", bkpinfo->isodir + strlen(tmp)); 618 } 619 mr_free(tmp); 620 621 mr_asprintf(&tmp, "%s/ISODIR", bkpinfo->tmpdir); 622 write_one_liner_data_file(tmp, iso_path); 623 mr_free(tmp); 611 612 log_it("res of it = %s", iso_mnt); 613 mr_fprintf(fd1, "iso-mnt %s\n", iso_mnt); 614 log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt)); 615 616 mr_asprintf(&iso_tmp, "%s", bkpinfo->isodir); 617 if (strlen(iso_tmp) >= strlen(iso_mnt)) { 618 mr_asprintf(&iso_path, "%s", iso_tmp + strlen(iso_mnt)); 619 } 620 mr_free(iso_tmp); 621 mr_free(iso_mnt); 622 624 623 log_it("isodir: %s", iso_path); 624 mr_fprintf(fd1, "isodir %s\n", iso_path); 625 625 mr_free(iso_path); 626 mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 627 write_one_liner_data_file(tmp, bkpinfo->prefix); 626 628 627 log_it("iso-prefix: %s", bkpinfo->prefix); 629 mr_free(tmp); 630 /* End patch */ 628 mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix); 629 630 mr_fclose(fd1); 631 631 } // end of iso code 632 632 -
trunk/mondo/src/common/libmondo-tools.h
r171 r1106 3 3 */ 4 4 5 #ifndef LIBMONDO_TOOLS_H 6 # define LIBMONDO_TOOLS_H 7 5 8 void clean_up_KDE_desktop_if_necessary(void); 6 9 7 long get_time( );10 long get_time(void); 8 11 extern void (*log_debug_msg) (int debug_level, const char *szFile, 9 12 const char *szFunction, int nLine, … … 20 23 void initialize_raidrec(struct raid_device_record *raidrec); 21 24 #endif 22 int some_basic_system_sanity_checks( );25 int some_basic_system_sanity_checks(void); 23 26 24 27 … … 45 48 void free_libmondo_global_strings(void); 46 49 47 double get_kernel_version( );48 char *get_architecture( );50 double get_kernel_version(void); 51 char *get_architecture(void); 49 52 bool does_nonMS_partition_exist(void); 50 53 void stop_magicdev_if_necessary(void); 51 54 void restart_magicdev_if_necessary(void); 55 56 #endif /* LIBMONDO_TOOLS_H */ -
trunk/mondo/src/common/newt-specific-EXT.h
r688 r1106 5 5 extern bool ask_me_OK_or_cancel(char *prompt); 6 6 extern void close_evalcall_form(void); 7 extern void close_progress_form( );7 extern void close_progress_form(void); 8 8 extern void fatal_error(char *error_string); 9 9 extern void finish(int signal); … … 17 17 extern bool popup_and_get_string(char *title, char *b, char *output); 18 18 extern bool popup_with_buttons(char *p, char *button1, char *button2); 19 extern void refresh_log_screen( );20 extern void setup_newt_stuff( );19 extern void refresh_log_screen(void); 20 extern void setup_newt_stuff(void); 21 21 extern void update_evalcall_form_ratio(int num, int denom); 22 22 extern void update_evalcall_form(int curr); … … 30 30 31 31 extern t_bkptype which_backup_media_type(bool); 32 extern int which_compression_level( );32 extern int which_compression_level(void); 33 33 34 34 -
trunk/mondo/src/common/newt-specific.c
r1086 r1106 351 351 */ 352 352 void 353 finish(int signal ) {353 finish(int signal_code) { 354 354 char *command = NULL; 355 355 356 <<<<<<< .courant 357 ======= 358 /* if (signal_code==0) { popup_and_OK("Please press <enter> to quit."); } */ 359 360 /* newtPopHelpLine(); */ 361 362 >>>>>>> .fusion-droit.r1105 356 363 register_pid(0, "mondo"); 357 364 chdir("/"); … … 378 385 } 379 386 } 387 <<<<<<< .courant 380 388 printf(_("Execution run ended; result=%d\n"), signal); 381 389 printf(_("Type 'less %s' to see the output log\n"), MONDO_LOGFILE); 390 ======= 391 // system("clear"); 392 // iamhere("Finished calling newtFinished"); 393 printf("Execution run ended; result=%d\n", signal_code); 394 printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE); 395 >>>>>>> .fusion-droit.r1105 382 396 free_libmondo_global_strings(); 383 exit(signal );397 exit(signal_code); 384 398 } 385 399 … … 650 664 void 651 665 popup_and_OK(char *prompt) { 652 charch;666 int ch; 653 667 654 668 assert_string_is_neither_NULL_nor_zerolength(prompt); -
trunk/mondo/src/common/newt-specific.h
r688 r1106 3 3 */ 4 4 5 5 #ifndef NEWT_SPECIFIC_H 6 # define NEWT_SPECIFIC_H 6 7 #ifndef H_NEWT 7 8 #include <newt.h> … … 11 12 bool ask_me_OK_or_cancel(char *prompt); 12 13 void close_evalcall_form(void); 13 void close_progress_form( );14 void close_progress_form(void); 14 15 void fatal_error(char *error_string); 15 16 void finish(int signal); … … 23 24 bool popup_and_get_string(char *title, char *b, char *output); 24 25 bool popup_with_buttons(char *p, char *button1, char *button2); 25 void refresh_log_screen( );26 void setup_newt_stuff( );26 void refresh_log_screen(void); 27 void setup_newt_stuff(void); 27 28 void update_evalcall_form_ratio(int num, int denom); 28 29 void update_evalcall_form(int curr); … … 36 37 37 38 t_bkptype which_backup_media_type(bool); 38 int which_compression_level( );39 int which_compression_level(void); 39 40 40 41 41 42 void popup_changelist_from_file(char *source_file); 43 44 #endif /* NEWT_SPECIFIC_H */ 45 -
trunk/mondo/src/include/mr_err.h
r1074 r1106 9 9 #define MR_ERR_H 10 10 11 #include "mr_msg.h" 12 11 13 /* functions (public methods) */ 12 14 13 15 extern inline void mr_exit(int errorcode, const char *message); 14 extern inline void mr_log_exit(int errorcode, const char *message); 16 #define mr_log_exit(x,y) {mr_msg(0,y); mr_exit(x, y);} 15 17 16 18 #endif /* MR_ERR_H */ -
trunk/mondo/src/include/mr_mem.h
r1074 r1106 13 13 #endif 14 14 #include <stdarg.h> 15 #include <stdio.h> 15 16 16 17 /* functions (public methods) */ 17 18 18 extern inline void mr_free(char *allocated); 19 extern inline void mr_allocstr(char *alloc, const char *orig); 20 extern inline void mr_asprintf(char **alloc, const char *fmt, ...); 21 extern inline void mr_getline(char **lineptr, size_t *n, FILE *stream); 22 extern inline void *mr_malloc(size_t size); 19 #define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__) 20 #define mr_allocstr(x,y) mr_allocstr_int(x, y,__LINE__,__FILE__) 21 #define mr_asprintf(x,y,args...) mr_asprintf_int(x,__LINE__,__FILE__, y, ## args) 22 #define mr_getline(x,y,z) mr_getline_int(x, y,z,__LINE__,__FILE__) 23 #define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__) 24 25 /* Internal function bringing debuging info 26 * called indirectly through macros */ 27 extern inline void mr_free_int(void **allocated, int line, char *file); 28 extern inline void mr_allocstr_int(char *alloc, const char *orig, int line, char *file); 29 extern inline void mr_asprintf_int(char **alloc, int line, char *file, const char *fmt, ...); 30 extern inline void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, char *file); 31 extern inline void *mr_malloc_int(size_t size, int line, char *file); 23 32 24 33 #endif /* MR_MEM_H */ -
trunk/mondo/src/include/mr_msg.h
r1074 r1106 16 16 /* functions (public methods) */ 17 17 18 extern inline void mr_msg(int debug, const char *fmt, ...); 18 #define mr_msg(x,y,args...) {mr_msg_int(x,__LINE__,__FILE__,y,## args);} 19 19 extern void mr_msg_init(const char *configfile, int loglevel); 20 20 extern void mr_msg_close(void); 21 21 22 /* Internal function bringing debuging info 23 * called indirectly through macros */ 24 extern inline void mr_msg_int(int debug,int line, const char *file, const char *fmt, ...); 25 22 26 #endif /* MR_MSG_H */ -
trunk/mondo/src/include/mr_str.h
r1079 r1106 13 13 extern inline char *mr_strtok(char *instr, const char *delims, int *lastpos); 14 14 extern inline char *mr_stresc(char *instr, char *toesc, const char escchr); 15 extern inline char *mr_date(void); 15 16 16 17 #endif /* MR_STR_H */ -
trunk/mondo/src/include/my-stuff.h
r1081 r1106 13 13 /*The number of lines of log output to keep at the bottom of the screen.*/ 14 14 #define NOOF_ERR_LINES 6 15 16 /* Hardcoded: Bad for the moment */ 17 #define MONDO_CACHE "/var/cache/mondo" 18 #define MONDORESTORECFG MONDO_CACHE"/mondo-restore.cfg" 19 15 20 16 21 /** … … 270 275 * Free variables and call finish(@p x). 271 276 */ 272 #define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) mr_free ( g_bkpinfo_DONTUSETHIS ); finish(x); }277 #define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) mr_free ( (void*) g_bkpinfo_DONTUSETHIS ); finish(x); } 273 278 274 279 /** -
trunk/mondo/src/lib/Makefile.am
r900 r1106 7 7 noinst_LIBRARIES = libmr.a 8 8 9 libmr_a_SOURCES = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c 9 libmr_a_SOURCES = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c mr_file.c -
trunk/mondo/src/lib/mr_err.c
r1074 r1106 27 27 /* We have to properly end newt */ 28 28 /* We have to remind people of log files */ 29 mr_msg_close(); 29 30 } 30 31 … … 38 39 exit(errorcode); 39 40 } 40 41 void mr_log_exit(int errorcode, const char *message) {42 mr_msg(0, message);43 mr_exit(errorcode, message);44 } -
trunk/mondo/src/lib/mr_mem.c
r1074 r1106 22 22 /* 23 23 * Function that frees memory if necessary 24 * A pointer to the memory pointed is passed to it. 25 * *allocated variable points then to the original content 26 * pointed to by the caller 24 27 */ 25 void mr_free (void *allocated) {28 void mr_free_int(void **allocated, int line, const char *file) { 26 29 27 30 /* free man pages says that if allocated is NULL 28 31 * nothing happens 29 32 */ 30 free(allocated); 31 allocated = NULL; 33 if (*allocated != NULL) { 34 free(*allocated); 35 *allocated = NULL; 36 } else { 37 mr_msg_int(0,line,file,"Attempt to reference NULL pointer\nExiting..."); 38 mr_exit(-1,"Attempt to reference NULL pointer"); 39 } 32 40 } 33 41 34 42 /* encapsulation function for malloc */ 35 void *mr_malloc (size_t size) {43 void *mr_malloc_int(size_t size, int line, const char *file) { 36 44 37 45 void *ret; … … 39 47 ret = malloc(size); 40 48 if (ret == NULL) { 41 mr_log_exit(-1,"Unable to alloc memory in mr_malloc\nExiting..."); 49 mr_msg_int(0,line,file,"Unable to alloc memory in mr_malloc\nExiting..."); 50 mr_exit(-1,"Unable to alloc memory in mr_malloc"); 42 51 } 43 52 return(ret); … … 45 54 46 55 /* encapsulation function for getline */ 47 void mr_getline (char **lineptr, size_t *n, FILE *stream) {56 void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, const char *file) { 48 57 49 58 ssize_t ret; … … 51 60 ret = getline(lineptr,n,stream); 52 61 if (ret == -1) { 53 mr_log_exit(-1,"Unable to alloc memory in mr_getline\nExiting..."); 62 mr_msg_int(0,line,file,"Unable to alloc memory in mr_getline\nExiting...",line,file); 63 mr_exit(-1,"Unable to alloc memory in mr_getline"); 54 64 } 55 65 } 56 66 57 67 /* encapsulation function for asprintf */ 58 void mr_asprintf (char **strp, const char *fmt, ...) {68 void mr_asprintf_int(char **strp, int line, const char *file, const char *fmt, ...) { 59 69 60 70 int res = 0; … … 64 74 res = vasprintf(strp, fmt, args); 65 75 if (res == -1) { 66 mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting..."); 76 mr_msg_int(0,line,file,"Unable to alloc memory in mr_asprintf\nExiting...",line,file); 77 mr_exit(-1,"Unable to alloc memory in mr_asprintf"); 67 78 } 68 79 va_end(args); … … 73 84 * freeing it before in any case 74 85 */ 75 void mr_allocstr (char *alloc, const char *orig) {86 void mr_allocstr_int(char *alloc, const char *orig, int line, const char *file) { 76 87 77 mr_free ((void *)alloc);78 mr_asprintf (&alloc, orig);88 mr_free_int((void **)&alloc, line, file); 89 mr_asprintf_int(&alloc, line, file, orig); 79 90 } -
trunk/mondo/src/lib/mr_msg.c
r1074 r1106 52 52 * Function that log a message. Not called directly 53 53 * but through other functions 54 * fmt needs to be just before ... 54 55 */ 55 void mr_msg (int debug, const char *fmt, ...) {56 void mr_msg_int(int debug, int line, const char *file, const char *fmt, ...) { 56 57 57 58 int i = 0; … … 74 75 for (i = 1; i < debug; i++) 75 76 fprintf(fout, " "); 76 fprintf(fout, "%s ->%s#%d: ", __FILE__, __FUNCTION__, __LINE__);77 fprintf(fout, "%s #%d: ", file, line); 77 78 } 78 79 va_start(args,fmt); -
trunk/mondo/src/lib/mr_str.c
r1079 r1106 8 8 #include <stdio.h> 9 9 #include <string.h> 10 #include <time.h> 10 11 11 12 #include "mr_mem.h" … … 105 106 return retstr; 106 107 } 108 109 /* Return a string containing the date */ 110 char *mr_date(void) { 111 112 time_t tcurr; 113 114 tcurr = time(NULL); 115 return(ctime(&tcurr)); 116 } 117 -
trunk/mondo/src/mondoarchive/main.c
r1086 r1106 15 15 #include <stdio.h> 16 16 #include <stdlib.h> 17 #include <sys/types.h> 18 #include <sys/stat.h> 19 #include <unistd.h> 20 17 21 #include "my-stuff.h" 18 22 #include "../common/mondostructures.h" … … 21 25 22 26 #include "mr_mem.h" 27 #include "mr_str.h" 28 #include "mr_file.h" 23 29 24 30 // for CVS … … 124 130 } 125 131 126 /* Return a string containing the date */127 char *mr_date(void) {128 129 time_t tcurr;130 131 tcurr = time(NULL);132 return(ctime(&tcurr));133 }134 135 132 /*-----------------------------------------------------------*/ 136 133 … … 144 141 { 145 142 struct s_bkpinfo *bkpinfo; 143 struct stat stbuf; 146 144 char *tmp; 147 145 int res = 0; … … 192 190 setenv("ARCH", get_architecture(), 1); 193 191 194 /* Add MONDO_SHARE environment variable for mindi */192 /* Add MONDO_SHARE + others environment variable for mindi */ 195 193 setenv_mondo_share(); 194 195 if (stat(MONDO_CACHE, &stbuf) != 0) { 196 mr_mkdir(MONDO_CACHE,0x755); 197 } 196 198 197 199 /* Configure the bkpinfo structure, global file paths, etc. */ -
trunk/mondo/src/mondorestore/mondo-prep.c
r1086 r1106 2010 2010 system("clear"); 2011 2011 newtResume(); 2012 mr_free( drivelist);2012 mr_free((void*) drivelist); 2013 2013 return (retval); 2014 2014 } … … 2604 2604 } 2605 2605 log_to_screen(_("Mountlist adjusted to suit current hard drive(s)")); 2606 mr_free( drivelist);2606 mr_free((void*) drivelist); 2607 2607 } 2608 2608 -
trunk/mondo/src/mondorestore/mondo-rstr-newt.c
r1086 r1106 67 67 /** int ****************************************************************/ 68 68 int i = 0; 69 int i ndex = 0;69 int idx = 0; 70 70 int currline = 0; 71 71 int items = 0; … … 103 103 log_it("I don't know what this button does"); 104 104 } else { 105 i ndex = find_next_free_index_in_disklist(disklist);105 idx = find_next_free_index_in_disklist(disklist); 106 106 107 107 items = disklist->entries; 108 108 strcpy(disklist->el[items].device, 109 109 unallocated_raid_partitions->el[currline].device); 110 disklist->el[items].index = i ndex;110 disklist->el[items].index = idx; 111 111 disklist->entries = ++items; 112 112 … … 1733 1733 calculate_raid_device_size(mountlist, raidlist, 1734 1734 raidrec->raid_device); 1735 mr_free( bkp_raidrec);1735 mr_free((void*) bkp_raidrec); 1736 1736 #endif 1737 1737 } … … 2259 2259 2260 2260 /** int ***************************************************************/ 2261 int i ndex = -1;2261 int idx = -1; 2262 2262 int pos = 0; 2263 2263 … … 2269 2269 for (done = FALSE; !done;) { 2270 2270 for (pos = 0; 2271 pos < disklist->entries && disklist->el[pos].index <= i ndex;2271 pos < disklist->entries && disklist->el[pos].index <= idx; 2272 2272 pos++); 2273 2273 if (pos >= disklist->entries) { 2274 2274 done = TRUE; 2275 2275 } else { 2276 i ndex = disklist->el[pos].index;2277 } 2278 } 2279 return (i ndex + 1);2276 idx = disklist->el[pos].index; 2277 } 2278 } 2279 return (idx + 1); 2280 2280 } 2281 2281 … … 2335 2335 char *isodir_path, bool nuke_me_please) 2336 2336 { 2337 char *value = NULL; 2337 2338 2338 2339 /** initialize ********************************************************/ 2339 2340 // %d no var ??? 2341 // log_it("%d - AAA - isodir_path = %s", isodir_path); 2340 malloc_string(value); 2341 2342 2342 if (isodir_device == NULL) { 2343 2343 mr_asprintf(&isodir_device, "/dev/"); … … 2346 2346 mr_asprintf(&isodir_path, "/"); 2347 2347 } 2348 if ( does_file_exist("/tmp/NFS-SERVER-PATH")) {2349 mr_free(isodir_device);2350 isodir_device = last_line_of_file("/tmp/NFS-SERVER-MOUNT");2348 if (read_cfg_var(g_mondo_cfg_file, "nfs-server-path", value) == 0) { 2349 read_cfg_var(g_mondo_cfg_file, "nfs-server-mount", isodir_device); 2350 mr_free(isodir_format); 2351 2351 mr_asprintf(&isodir_format, "nfs"); 2352 2352 mr_free(isodir_path); 2353 isodir_path = last_line_of_file("/tmp/NFS-SERVER-PATH"); 2354 } 2353 mr_asprintf(isodir_path, value); 2354 } 2355 mr_free(value); 2356 2355 2357 if (nuke_me_please) { 2356 2358 return (TRUE); … … 2451 2453 * Dummy function that proves that we can get to the point where Mondo is run. 2452 2454 */ 2453 void nuke_mode_dummy( )2455 void nuke_mode_dummy(void) 2454 2456 { 2455 2457 … … 2912 2914 sizeof(struct list_of_disks)); 2913 2915 } 2914 mr_free( bkp_raidrec);2915 mr_free( bkp_disklist);2916 mr_free( bkp_raidlist);2917 mr_free( unallocated_raid_partitions);2916 mr_free((void*) bkp_raidrec); 2917 mr_free((void*) bkp_disklist); 2918 mr_free((void*) bkp_raidlist); 2919 mr_free((void*) unallocated_raid_partitions); 2918 2920 } 2919 2921 #endif -
trunk/mondo/src/mondorestore/mondo-rstr-newt.h
r783 r1106 120 120 char *mountlist_entry_to_string(struct mountlist_itself *, int); 121 121 void mvaddstr_and_log_it(int, int, char *); 122 void nuke_mode_dummy( );122 void nuke_mode_dummy(void); 123 123 char *number_of_disks_as_string(int, char *); 124 124 void open_evalcall_form(char *); -
trunk/mondo/src/mondorestore/mondo-rstr-tools-EXT.h
r914 r1106 3 3 **/ 4 4 5 extern void free_MR_global_filenames( );5 extern void free_MR_global_filenames(void); 6 6 extern void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *); 7 7 extern bool is_file_in_list(char *, char *, char *); /* needle, haystack, preamble */ -
trunk/mondo/src/mondorestore/mondo-rstr-tools.c
r1086 r1106 55 55 * Free the malloc()s for the filename variables. 56 56 */ 57 void free_MR_global_filenames( )57 void free_MR_global_filenames(void) 58 58 { 59 59 mr_free(g_biggielist_txt); … … 537 537 538 538 assert(p_external_copy_of_mountlist != NULL); 539 mountlist = mr_malloc(sizeof(struct mountlist_itself));539 mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself)); 540 540 memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist, 541 541 sizeof(struct mountlist_itself)); … … 620 620 } 621 621 run_program_and_log_output("df -m", 3); 622 mr_free( mountlist);622 mr_free((void*) mountlist); 623 623 return (retval); 624 624 } … … 918 918 919 919 read_cfg_var(cfg_file, "acl", value); 920 if (strstr(value, " TRUE")) {920 if (strstr(value, "yes")) { 921 921 mr_asprintf(&g_getfacl,"setfacl"); 922 922 mr_msg(1, "We will restore ACLs"); … … 926 926 } 927 927 read_cfg_var(cfg_file, "xattr", value); 928 if (strstr(value, " TRUE")) {928 if (strstr(value, "yes")) { 929 929 mr_asprintf(&g_getfattr,"setfattr"); 930 930 mr_msg(1, "We will restore XATTRs"); … … 2027 2027 assert(p_external_copy_of_mountlist != NULL); 2028 2028 2029 mountlist = mr_malloc(sizeof(struct mountlist_itself));2029 mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself)); 2030 2030 memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist, 2031 2031 sizeof(struct mountlist_itself)); … … 2120 2120 log_to_screen(_("All partitions were unmounted OK.")); 2121 2121 } 2122 mr_free( mountlist);2122 mr_free((void*) mountlist); 2123 2123 return (retval); 2124 2124 } … … 2441 2441 char *screen_message = NULL; 2442 2442 2443 raidlist = mr_malloc(sizeof(struct raidlist_itself));2443 raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself)); 2444 2444 2445 2445 assert(wait_for_percentage <= 100); … … 2479 2479 } 2480 2480 } 2481 mr_free( raidlist);2482 } 2481 mr_free((void*) raidlist); 2482 } -
trunk/mondo/src/mondorestore/mondo-rstr-tools.h
r1079 r1106 3 3 **/ 4 4 5 void free_global_filenames( );5 void free_global_filenames(void); 6 6 void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *); 7 7 bool is_file_in_list(char *, char *, char *); /* needle, haystack, preamble */ -
trunk/mondo/src/test/mktest
r1079 r1106 7 7 8 8 lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c" 9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align - O2 -g -I../common -I../include"9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align -fno-strict-aliasing -O2 -g -I../common -I../include" 10 10 11 11 echo "Generating test-msg" … … 15 15 echo "Generating test-conf" 16 16 gcc $OPT test-conf.c $lib -o test-conf 17 echo "Generating test-mem" 18 gcc $OPT test-mem.c $lib -o test-mem 17 19 18 20 echo "Testing against previous run" 19 for f in test-conf test-string test-msg ; do21 for f in test-conf test-string test-msg test-mem; do 20 22 chmod 755 $f 21 23 ./$f > /tmp/$f.res … … 23 25 if [ $? -ne 0 ]; then 24 26 echo "$f test KO !!" 27 else 28 echo "$f test OK" 25 29 fi 26 30 valgrind -q --error-exitcode=1 --leak-check=yes ./$f 2>&1 > /tmp/valgrind-$f.res
Note:
See TracChangeset
for help on using the changeset viewer.