Changeset 783 in MondoRescue for trunk/mondo/mondo/common
- Timestamp:
- Aug 31, 2006, 5:09:20 PM (18 years ago)
- Location:
- trunk/mondo/mondo/common
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/Makefile.am
r539 r783 2 2 ## Process this file with Automake to generate `Makefile.in' 3 3 ## 4 AM_CPPFLAGS = -DMONDO_SHARE=\"$(pkgdatadir)\" 4 AM_CPPFLAGS = -DMONDO_SHARE=\"$(pkgdatadir)\" -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/mondo/include 5 5 6 6 ## libmondo … … 8 8 9 9 libmondo_a_SOURCES = libmondo-archive.c libmondo-devices.c libmondo-fifo.c \ 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 10 libmondo-filelist.c libmondo-files.c libmondo-fork.c \ 11 libmondo-mountlist.c libmondo-raid.c libmondo-msg.c \ 12 libmondo-stream.c libmondo-string.c libmondo-tools.c \ 13 libmondo-verify.c newt-specific.c \ 14 libmondo-archive.h libmondo-devices.h \ 15 libmondo-filelist.h libmondo-files.h libmondo-fork.h \ 16 libmondo-mountlist.h libmondo-raid.h \ 17 libmondo-stream.h libmondo-string.h libmondo-tools.h \ 18 libmondo-verify.h libmondo-fifo.h \ 19 libmondo-archive-EXT.h my-stuff.h mondostructures.h \ 20 libmondo-devices-EXT.h libmondo-fifo-EXT.h \ 21 libmondo-files-EXT.h libmondo-fork-EXT.h \ 22 libmondo-filelist-EXT.h \ 23 libmondo-mountlist-EXT.h libmondo-raid-EXT.h \ 24 libmondo-string-EXT.h libmondo-tools-EXT.h \ 25 libmondo-verify-EXT.h libmondo-stream-EXT.h \ 26 newt-specific.h -
trunk/mondo/mondo/common/libmondo-archive-EXT.h
r539 r783 15 15 extern int make_slices_and_images(struct s_bkpinfo *bkpinfo, 16 16 char *biggielist_fname); 17 extern int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,char *destfile);17 extern int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile); 18 18 extern int make_afioballs_and_images(struct s_bkpinfo *bkpinfo); 19 19 extern int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...); -
trunk/mondo/mondo/common/libmondo-archive.c
r729 r783 10 10 */ 11 11 12 #include " ../common/my-stuff.h"12 #include "my-stuff.h" 13 13 #include "../common/mondostructures.h" 14 #include "mr_conf.h" 14 15 #include "libmondo-string-EXT.h" 15 16 #include "libmondo-stream-EXT.h" … … 80 81 */ 81 82 t_bkptype g_backup_media_type = none; 83 char *g_backup_media_string = NULL; 82 84 83 85 /** … … 231 233 log_msg(5, "command='%s'", command); 232 234 res = system(command); 233 tmp = last_line_of_file(MONDO_LOGFILE) );235 tmp = last_line_of_file(MONDO_LOGFILE); 234 236 log_msg(1, "res=%d; tmp='%s'", res, tmp); 235 237 if (bkpinfo->use_star && (res == 254 || res == 65024) … … 390 392 } 391 393 392 if (g_tmpfs_mountpt [0] != '\0') {394 if (g_tmpfs_mountpt != NULL) { 393 395 tmp = call_program_and_get_last_line_of_output 394 396 ("df -m -P | grep dev/shm | grep -v none | tr -s ' ' '\t' | cut -f4"); … … 424 426 * @ingroup archiveGroup 425 427 */ 426 int backup_data(struct s_bkpinfo *bkpinfo , struct s_mrconf *mrconf)428 int backup_data(struct s_bkpinfo *bkpinfo) 427 429 { 428 430 int retval = 0, res = 0; … … 651 653 else 652 654 ch = 'U'; 655 653 656 if (bkpinfo->boot_loader != '\0') { 654 657 asprintf(&tmp, "User specified boot loader. It is '%c'.", … … 743 746 } 744 747 paranoid_free(tmp); 748 /* BERLIOS: Use bkptype_to_string without LANG */ 745 749 switch (bkpinfo->backup_media_type) { 746 750 case cdr: … … 1106 1110 * @ingroup MLarchiveGroup 1107 1111 */ 1108 int do_that_final_phase(struct s_bkpinfo *bkpinfo , struct s_mrconf *mrconf)1112 int do_that_final_phase(struct s_bkpinfo *bkpinfo) 1109 1113 { 1110 1114 … … 1125 1129 } else { 1126 1130 /* write final ISO */ 1127 res = write_final_iso_if_necessary(bkpinfo , mrconf);1131 res = write_final_iso_if_necessary(bkpinfo); 1128 1132 retval += res; 1129 1133 if (res) { … … 1178 1182 g_serial_string = call_program_and_get_last_line_of_output("dd \ 1179 1183 if=/dev/urandom bs=16 count=1 2> /dev/null | \ 1180 hexdump | tr -s ' ' '0' | head -n1") );1184 hexdump | tr -s ' ' '0' | head -n1"); 1181 1185 asprintf(&tmp, "%s...word.", g_serial_string); 1182 1186 paranoid_free(g_serial_string); … … 1269 1273 } 1270 1274 /* if not Debian then go ahead & use fdformat */ 1271 tempfile = call_program_and_get_last_line_of_output("mktemp -q /tmp/mondo.XXXXXXXX") );1275 tempfile = call_program_and_get_last_line_of_output("mktemp -q /tmp/mondo.XXXXXXXX"); 1272 1276 asprintf(&command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile, 1273 1277 tempfile, tempfile); … … 1294 1298 if (trackno <= 5 && last_trkno > 40) { 1295 1299 close_evalcall_form(); 1296 strcpy(title, "Verifying format"); 1297 open_evalcall_form(title); 1300 open_evalcall_form("Verifying format"); 1298 1301 } 1299 1302 last_trkno = trackno; … … 1401 1404 * @return The number of errors encountered (0 for success) 1402 1405 */ 1403 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo , struct s_mrconf *mrconf)1406 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo) 1404 1407 { 1405 1408 … … 1544 1547 } else { 1545 1548 res = 1546 move_files_to_cd(bkpinfo, mrconf,storing_filelist_fname,1549 move_files_to_cd(bkpinfo, storing_filelist_fname, 1547 1550 curr_xattr_list_fname, 1548 1551 curr_acl_list_fname, … … 1624 1627 * @return The number of errors encountered (0 for success) 1625 1628 */ 1626 int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,char *destfile)1629 int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile) 1627 1630 { 1628 1631 /*@ int ********************************************** */ … … 1667 1670 /* BERLIOS: Do not ignore getcwd result */ 1668 1671 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1669 asprintf(&tmp, "chmod 7 44%s", bkpinfo->scratchdir);1672 asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir); 1670 1673 run_program_and_log_output(tmp, FALSE); 1671 1674 paranoid_free(tmp); 1672 1675 chdir(bkpinfo->scratchdir); 1673 1676 1674 if (bkpinfo->call_before_iso [0] != '\0') {1677 if (bkpinfo->call_before_iso != NULL) { 1675 1678 asprintf(&message_to_screen, "Running pre-ISO call for CD#%d", 1676 1679 g_current_media_number); … … 1687 1690 } 1688 1691 1689 if (bkpinfo->call_make_iso [0] != '\0') {1692 if (bkpinfo->call_make_iso != NULL) { 1690 1693 log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso); 1691 1694 asprintf(&tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir); 1692 1695 asprintf(&message_to_screen, "Making an ISO (%s #%d)", 1693 media_descriptor_string(bkpinfo->backup_media_type),1696 bkpinfo->backup_media_string, 1694 1697 g_current_media_number); 1695 1698 … … 1789 1792 } else { 1790 1793 asprintf(&message_to_screen, "Running mkisofs to make %s #%d", 1791 media_descriptor_string(bkpinfo->backup_media_type),1794 bkpinfo->backup_media_string, 1792 1795 g_current_media_number); 1793 1796 log_msg(1, message_to_screen); 1794 1797 asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ", 1795 media_descriptor_string(bkpinfo->backup_media_type),1798 bkpinfo->backup_media_string, 1796 1799 g_current_media_number); 1797 1800 if (bkpinfo->nonbootable_backup) { … … 1818 1821 #ifdef __IA64__ 1819 1822 log_msg(1, "IA64 --> elilo"); 1820 asprintf(&tmp2,"mkisofs -no-emul-boot -b images/mindi-bootroot.%s.img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", mrconf->ia64_boot_size);1823 asprintf(&tmp2,"mkisofs -no-emul-boot -b images/mindi-bootroot.%s.img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", bkpinfo->mrconf->mindi_ia64_boot_size); 1821 1824 res = eval_call_to_make_ISO(bkpinfo, 1822 1825 tmp2, … … 1870 1873 } 1871 1874 1872 if (bkpinfo->call_burn_iso [0] != '\0') {1875 if (bkpinfo->call_burn_iso != NULL) { 1873 1876 log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso); 1874 1877 asprintf(&message_to_screen, "Burning %s #%d", 1875 media_descriptor_string(bkpinfo->backup_media_type),1878 bkpinfo->backup_media_string, 1876 1879 g_current_media_number); 1877 1880 pause_and_ask_for_cdr(2, &cd_is_mountable); … … 1888 1891 } 1889 1892 1890 if (bkpinfo->call_after_iso [0] != '\0') {1893 if (bkpinfo->call_after_iso != NULL) { 1891 1894 asprintf(&message_to_screen, "Running post-ISO call (%s #%d)", 1892 media_descriptor_string(bkpinfo->backup_media_type),1895 bkpinfo->backup_media_string, 1893 1896 g_current_media_number); 1894 1897 res = eval_call_to_make_ISO(bkpinfo, bkpinfo->call_after_iso, … … 1922 1925 bigfile_fname); 1923 1926 log_msg(1, "command = '%s'", command); 1924 tmp = call_program_and_get_last_line_of_output(command) );1927 tmp = call_program_and_get_last_line_of_output(command); 1925 1928 log_msg(1, "--> tmp = '%s'", tmp); 1926 1929 paranoid_free(command); … … 1951 1954 */ 1952 1955 int 1953 make_slices_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,char *biggielist_fname)1956 make_slices_and_images(struct s_bkpinfo *bkpinfo, char *biggielist_fname) 1954 1957 { 1955 1958 … … 2070 2073 } 2071 2074 res = 2072 slice_up_file_etc(bkpinfo, mrconf,bigfile_fname,2075 slice_up_file_etc(bkpinfo, bigfile_fname, 2073 2076 ntfsprog_fifo, biggie_file_number, 2074 2077 noof_biggie_files, use_ntfsprog); … … 2119 2122 * @see make_afioballs_and_images 2120 2123 */ 2121 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo , struct s_mrconf *mrconf)2124 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo) 2122 2125 { 2123 2126 … … 2193 2196 } else { 2194 2197 res = 2195 move_files_to_cd(bkpinfo, mrconf,curr_filelist_fname,2198 move_files_to_cd(bkpinfo, curr_filelist_fname, 2196 2199 curr_xattr_list_fname, 2197 2200 curr_acl_list_fname, curr_afioball_fname, … … 2241 2244 * @ingroup MLarchiveGroup 2242 2245 */ 2243 int make_those_afios_phase(struct s_bkpinfo *bkpinfo , struct s_mrconf *mrconf)2246 int make_those_afios_phase(struct s_bkpinfo *bkpinfo) 2244 2247 { 2245 2248 /*@ int ******************************************* */ … … 2258 2261 log_msg(1, 2259 2262 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2260 res = make_afioballs_and_images_OLD(bkpinfo , mrconf);2263 res = make_afioballs_and_images_OLD(bkpinfo); 2261 2264 #else 2262 res = make_afioballs_and_images_OLD(bkpinfo , mrconf);2265 res = make_afioballs_and_images_OLD(bkpinfo); 2263 2266 #endif 2264 2267 write_header_block_to_stream((off_t)0, "stop-afioballs", 2265 2268 BLK_STOP_AFIOBALLS); 2266 2269 } else { 2267 res = make_afioballs_and_images(bkpinfo , mrconf);2270 res = make_afioballs_and_images(bkpinfo); 2268 2271 } 2269 2272 … … 2371 2374 * transfer files over the network) or leave it as is. 2372 2375 */ 2373 int (*move_files_to_cd) (struct s_bkpinfo *, struct s_mrconf *mrconf,char *, ...) =2376 int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...) = 2374 2377 _move_files_to_cd; 2375 2378 … … 2392 2395 * @return The number of errors encountered (0 for success) 2393 2396 */ 2394 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,char *files_to_add, ...)2397 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, char *files_to_add, ...) 2395 2398 { 2396 2399 … … 2431 2434 if (would_occupy / 1024 > bkpinfo->media_size[g_current_media_number]) { 2432 2435 /* FALSE because this is not the last CD we'll write */ 2433 res = write_iso_and_go_on(bkpinfo, mrconf,FALSE);2436 res = write_iso_and_go_on(bkpinfo, FALSE); 2434 2437 retval += res; 2435 2438 if (res) { … … 2823 2826 2824 2827 asprintf(&szmsg, "I am about to burn %s #%d", 2825 media_descriptor_string(g_backup_media_type),2828 g_backup_media_string, 2826 2829 g_current_media_number); 2827 2830 log_to_screen(szmsg); … … 2860 2863 log_to_screen 2861 2864 ("%s has data on it but it's probably not a Mondo CD.", 2862 media_descriptor_string(g_backup_media_type));2865 g_backup_media_string); 2863 2866 asprintf(&our_serial_str, "%s", ""); 2864 2867 } else { 2865 2868 log_to_screen("%s found in drive. It's a Mondo disk.", 2866 media_descriptor_string(g_backup_media_type));2869 g_backup_media_string); 2867 2870 tmp1 = last_line_of_file(szcdno); 2868 2871 cd_number = atoi(tmp1); … … 2885 2888 if (cd_number > 0 && !strcmp(our_serial_str, g_serial_string)) { 2886 2889 log_msg(2, "This %s is part of this backup set!", 2887 media_descriptor_string(g_backup_media_type));2890 g_backup_media_string); 2888 2891 ok_go_ahead_burn_it = FALSE; 2889 2892 if (cd_number == g_current_media_number - 1) { 2890 2893 log_to_screen 2891 2894 ("I think you've left the previous %s in the drive.", 2892 media_descriptor_string(g_backup_media_type));2895 g_backup_media_string); 2893 2896 } else { 2894 2897 log_to_screen 2895 2898 ("Please remove this %s. It is part of the backup set you're making now.", 2896 media_descriptor_string(g_backup_media_type));2899 g_backup_media_string); 2897 2900 } 2898 2901 } else { … … 2903 2906 log_msg(2, 2904 2907 "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", 2905 media_descriptor_string(g_backup_media_type));2908 g_backup_media_string); 2906 2909 if ((cdrw_device = interrogate_disk_currently_in_cdrw_drive(cdrw_device)) != NULL) { 2907 2910 ok_go_ahead_burn_it = FALSE; 2908 2911 log_to_screen("There isn't a writable %s in the drive.", 2909 media_descriptor_string(g_backup_media_type));2912 g_backup_media_string); 2910 2913 } 2911 2914 paranoid_free(cdrw_device); … … 2917 2920 asprintf(&tmp, 2918 2921 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", 2919 media_descriptor_string(g_backup_media_type),2922 g_backup_media_string, 2920 2923 g_current_media_number, 2921 media_descriptor_string(g_backup_media_type));2924 g_backup_media_string); 2922 2925 popup_and_OK(tmp); 2923 2926 paranoid_free(tmp); … … 2930 2933 log_msg(2, 2931 2934 "paafcd: OK, I assume I have a blank/reusable %s in the drive...", 2932 media_descriptor_string(g_backup_media_type));2935 g_backup_media_string); 2933 2936 2934 2937 log_to_screen("Proceeding w/ %s in drive.", 2935 media_descriptor_string(g_backup_media_type));2938 g_backup_media_string); 2936 2939 if (pmountable) { 2937 2940 if (attempt_to_mount_returned_this) { … … 2994 2997 */ 2995 2998 int 2996 slice_up_file_etc(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,char *biggie_filename,2999 slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename, 2997 3000 char *ntfsprog_fifo, long biggie_file_number, 2998 3001 long noof_biggie_files, bool use_ntfsprog) … … 3092 3095 } 3093 3096 lstat(biggie_filename, &biggiestruct.properties); 3094 strcpy(biggiestruct.filename, biggie_filename); 3097 if (strlen(checksum_line) <= MAX_STR_LEN) { 3098 strcpy(biggiestruct.filename, biggie_filename); 3099 } else { 3100 fatal_error("biggie_filename too big"); 3101 } 3095 3102 pB = strchr(checksum_line, ' '); 3096 3103 if (!pB) { … … 3100 3107 *pB = '\0'; 3101 3108 } 3102 strcpy(biggiestruct.checksum, checksum_line); 3109 if (strlen(checksum_line) <= 64) { 3110 strcpy(biggiestruct.checksum, checksum_line); 3111 } else { 3112 fatal_error("checksum_line too big"); 3113 } 3103 3114 paranoid_free(checksum_line); 3104 3115 … … 3125 3136 res = move_files_to_stream(bkpinfo,tmp,NULL); 3126 3137 } else { 3127 res = move_files_to_cd(bkpinfo, mrconf,tmp, NULL);3138 res = move_files_to_cd(bkpinfo, tmp, NULL); 3128 3139 } 3129 3140 paranoid_free(tmp); … … 3131 3142 for (slice_num = 1; !finished; slice_num++) { 3132 3143 curr_slice_fname_uncompressed = slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""); 3133 curr_slice_fname_compressed = slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix) );3144 curr_slice_fname_compressed = slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix); 3134 3145 3135 3146 tmp = percent_media_full_comment(bkpinfo); … … 3236 3247 res = move_files_to_stream(bkpinfo, file_to_archive, NULL); 3237 3248 } else { 3238 res = move_files_to_cd(bkpinfo, mrconf,file_to_archive, NULL);3249 res = move_files_to_cd(bkpinfo, file_to_archive, NULL); 3239 3250 } 3240 3251 paranoid_free(file_to_archive); … … 3332 3343 * however, this occurs rarely. 3333 3344 */ 3334 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo , struct s_mrconf *mrconf)3345 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo) 3335 3346 { 3336 3347 /*@ int ***************************************************** */ … … 3355 3366 #endif 3356 3367 paranoid_free(tmp); 3357 res = write_iso_and_go_on(bkpinfo, mrconf,TRUE);3368 res = write_iso_and_go_on(bkpinfo, TRUE); 3358 3369 #ifndef _XWIN 3359 3370 if (!g_text_mode) { … … 3383 3394 * @see make_iso_fs 3384 3395 */ 3385 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,bool last_cd)3396 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd) 3386 3397 { 3387 3398 /*@ pointers **************************************************** */ … … 3414 3425 } 3415 3426 log_msg(1, "OK, time to make %s #%d", 3416 media_descriptor_string(bkpinfo->backup_media_type),3427 bkpinfo->backup_media_string, 3417 3428 g_current_media_number); 3418 3429 … … 3461 3472 g_current_media_number); 3462 3473 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3463 res = make_iso_fs(bkpinfo, mrconf,isofile);3474 res = make_iso_fs(bkpinfo, isofile); 3464 3475 if (g_current_media_number == 1 && !res 3465 3476 && (bkpinfo->backup_media_type == cdr … … 3478 3489 log_to_screen 3479 3490 ("Please reboot from the 1st %s in Compare Mode, as a precaution.", 3480 media_descriptor_string(g_backup_media_type));3491 g_backup_media_string); 3481 3492 chdir("/"); 3482 3493 iamhere("Before calling verify_cd_image()"); … … 3488 3499 } else { 3489 3500 asprintf(&tmp, "Failed to burn %s #%d. Retry?", 3490 media_descriptor_string(bkpinfo->backup_media_type),3501 bkpinfo->backup_media_string, 3491 3502 g_current_media_number); 3492 3503 res = ask_me_yes_or_no(tmp); … … 3577 3588 g_current_media_number = cdno; 3578 3589 if (bkpinfo->backup_media_type != iso) { 3579 bkpinfo->media_device = find_cdrom_device(FALSE) );3590 bkpinfo->media_device = find_cdrom_device(FALSE); 3580 3591 } 3581 3592 chdir("/"); … … 3595 3606 asprintf(&tmp, 3596 3607 "Warnings/errors were reported while checking %s #%d", 3597 media_descriptor_string(bkpinfo-> 3598 backup_media_type), 3608 bkpinfo->backup_media_string, 3599 3609 g_current_media_number); 3600 3610 log_to_screen(tmp); … … 3745 3755 } 3746 3756 3747 void mr archive_init_conf(struct s_mrconf *mrconf) {3757 void mr_archive_init_conf(struct s_mr_conf *mr_conf) { 3748 3758 char *command = NULL; 3749 FILE *conffd = NULL;3750 3759 FILE *fin = NULL; 3751 int n = 0;3760 size_t n = 0; 3752 3761 char *param = NULL; 3753 3762 3754 mr conf = (struct s_mrconf *)malloc(sizeof(struct s_mrconf));3755 if (mr conf == NULL) {3756 fatal_error("Unable to malloc mr conf");3763 mr_conf = (struct s_mr_conf *)malloc(sizeof(struct s_mr_conf)); 3764 if (mr_conf == NULL) { 3765 fatal_error("Unable to malloc mr_conf"); 3757 3766 } 3758 3767 /* Default for everything int : 0 char * : NULL */ 3759 3768 3760 3769 /* mindi conf parameters also needed in mondo */ 3761 mr conf->ia64_boot_size = 0;3770 mr_conf->mindi_ia64_boot_size = 0; 3762 3771 3763 3772 asprintf(&command, "mindi -printvar IA64_BOOT_SIZE"); … … 3766 3775 pclose(fin); 3767 3776 paranoid_free(command); 3768 mr conf->ia64_boot_size = atoi(param);3777 mr_conf->mindi_ia64_boot_size = atoi(param); 3769 3778 paranoid_free(param); 3770 3779 3771 mr conf->iso_creation_cmd = NULL;3780 mr_conf->mondo_iso_creation_cmd = NULL; 3772 3781 3773 3782 /* Finds mondo conf file */ 3774 mr conf_open(MONDO_CONF_DIR"/mondo.conf");3783 mr_conf_open(MONDO_CONF_DIR"/mondo.conf"); 3775 3784 3776 3785 /* mondo conf parameters needed */ 3777 mrconf->iso_creation_cmd = mrconf_sread(iso_creation_cmd); 3778 3779 mrconf_close(); 3786 mr_conf->mondo_iso_creation_cmd = mr_conf_sread("mondo_iso_creation_cmd"); 3787 3788 mr_conf_close(); 3789 } -
trunk/mondo/mondo/common/libmondo-archive.h
r539 r783 17 17 int make_slices_and_images(struct s_bkpinfo *bkpinfo, 18 18 char *biggielist_fname); 19 int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf,char *destfile);19 int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile); 20 20 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo); 21 21 extern int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...); -
trunk/mondo/mondo/common/libmondo-devices-EXT.h
r171 r783 33 33 *, bool); 34 34 35 36 extern void make_fifo(char *store_name_here, char *stub);37 38 39 35 extern void insist_on_this_cd_number(struct s_bkpinfo *bkpinfo, 40 36 int cd_number_i_want); … … 69 65 70 66 extern char *which_partition_format(const char *drive); 67 extern char *bkptype_to_string(t_bkptype bt); -
trunk/mondo/mondo/common/libmondo-devices.c
r729 r783 63 63 if (bkpinfo->media_device != NULL) { 64 64 paranoid_alloc(g_cdrom_drive_is_here, bkpinfo->media_device); // just in case 65 }66 if (bkpinfo->media_device != NULL) {67 65 paranoid_alloc(g_dvd_drive_is_here, bkpinfo->media_device); // just in case 68 66 } … … 95 93 log_it("rctada: Unmounting all CD drives", __LINE__); 96 94 run_program_and_log_output("umount /dev/cdr* /dev/dvd*", 5); 95 } 96 97 98 /** 99 * Mount the CD-ROM at @p mountpoint. 100 * @param device The device (or file if g_ISO_restore_mode) to mount. 101 * @param mountpoint The place to mount it. 102 * @return TRUE for success, FALSE for failure. 103 */ 104 bool mount_CDROM_here(char *device, char *mountpoint) 105 { 106 /*@ buffer ****************************************************** */ 107 char *command = NULL; 108 int retval = 0; 109 110 assert_string_is_neither_NULL_nor_zerolength(device); 111 assert_string_is_neither_NULL_nor_zerolength(mountpoint); 112 113 make_hole_for_dir(mountpoint); 114 if (isdigit(device[0])) { 115 paranoid_free(device); 116 device = find_cdrom_device(FALSE); 117 } 118 if (g_ISO_restore_mode) { 119 120 #ifdef __FreeBSD__ 121 char *dev = NULL; 122 123 dev = make_vn(device)); 124 if (!dev) { 125 asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", 126 device); 127 fatal_error(command); 128 } 129 paranoid_free(device); 130 device = dev; 131 #endif 132 } 133 134 log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device, 135 mountpoint); 136 /*@ end vars *************************************************** */ 137 138 #ifdef __FreeBSD__ 139 asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", 140 device, mountpoint, MONDO_LOGFILE); 141 #else 142 asprintf(&command, "mount %s -o ro,loop -t iso9660 %s 2>> %s", 143 device, mountpoint, MONDO_LOGFILE); 144 #endif 145 146 log_msg(4, command); 147 if (strncmp(device, "/dev/", 5) == 0) { 148 retract_CD_tray_and_defeat_autorun(); 149 } 150 retval = system(command); 151 log_msg(1, "system(%s) returned %d", command, retval); 152 paranoid_free(command); 153 154 if (retval == 0) { 155 return(TRUE); 156 } else { 157 return(FALSE); 158 } 97 159 } 98 160 … … 1232 1294 1233 1295 /** 1234 * Mount the CD-ROM at @p mountpoint.1235 * @param device The device (or file if g_ISO_restore_mode) to mount.1236 * @param mountpoint The place to mount it.1237 * @return TRUE for success, FALSE for failure.1238 */1239 bool mount_CDROM_here(char *device, char *mountpoint)1240 {1241 /*@ buffer ****************************************************** */1242 char *command = NULL;1243 int retval = 0;1244 1245 assert_string_is_neither_NULL_nor_zerolength(device);1246 assert_string_is_neither_NULL_nor_zerolength(mountpoint);1247 1248 make_hole_for_dir(mountpoint);1249 if (isdigit(device[0])) {1250 paranoid_free(device);1251 device = find_cdrom_device(FALSE);1252 }1253 if (g_ISO_restore_mode) {1254 1255 #ifdef __FreeBSD__1256 char *dev = NULL;1257 1258 dev = make_vn(device));1259 if (!dev) {1260 asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)",1261 device);1262 fatal_error(command);1263 }1264 paranoid_free(device);1265 device = dev;1266 #endif1267 }1268 1269 log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device,1270 mountpoint);1271 /*@ end vars *************************************************** */1272 1273 #ifdef __FreeBSD__1274 asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",1275 device, mountpoint, MONDO_LOGFILE);1276 #else1277 asprintf(&command, "mount %s -o ro,loop -t iso9660 %s 2>> %s",1278 device, mountpoint, MONDO_LOGFILE);1279 #endif1280 1281 log_msg(4, command);1282 if (strncmp(device, "/dev/", 5) == 0) {1283 retract_CD_tray_and_defeat_autorun();1284 }1285 retval = system(command);1286 log_msg(1, "system(%s) returned %d", command, retval);1287 paranoid_free(command);1288 1289 if (retval == 0) {1290 return(TRUE);1291 } else {1292 return(FALSE);1293 }1294 }1295 1296 1297 /**1298 1296 * Ask the user for CD number @p cd_number_i_want. 1299 1297 * Sets g_current_media_number once the correct CD is inserted. … … 1355 1353 "FIXME - hacking bkpinfo->isodir from '%s' to /tmp/isodir", 1356 1354 bkpinfo->isodir); 1357 strcpy(bkpinfo->isodir, "/tmp/isodir");1355 paranoid_alloc(bkpinfo->isodir, "/tmp/isodir"); 1358 1356 } 1359 1357 } … … 1368 1366 cd_number_i_want); 1369 1367 asprintf(&tmp, "Insisting on %s #%d", 1370 media_descriptor_string(bkpinfo->backup_media_type),1368 bkpinfo->backup_media_string, 1371 1369 cd_number_i_want); 1372 1370 asprintf(&request, "Please insert %s #%d and press Enter.", 1373 media_descriptor_string(bkpinfo->backup_media_type),1371 bkpinfo->backup_media_string, 1374 1372 cd_number_i_want); 1375 1373 log_msg(3, tmp); … … 1451 1449 popup_and_OK(_("Please remove CD/floppy from drive(s)")); 1452 1450 } 1453 log_msg(3, "media type = %s", 1454 bkptype_to_string(bkpinfo->backup_media_type)); 1451 bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type); 1452 log_msg(3, "media type = %s",bkpinfo->backup_media_string); 1453 1455 1454 if (archiving_to_media) { 1456 1455 sensibly_set_tmpdir_and_scratchdir(bkpinfo); … … 1496 1495 } 1497 1496 asprintf(&comment, _("What speed is your %s (re)writer?"), 1498 media_descriptor_string(bkpinfo->backup_media_type));1497 bkpinfo->backup_media_string); 1499 1498 if (bkpinfo->backup_media_type == dvd) { 1499 paranoid_free(bkpinfo->media_device); 1500 1500 bkpinfo->media_device = find_dvd_device(); 1501 1501 asprintf(&tmp, "1"); … … 1521 1521 asprintf(&comment, 1522 1522 _("How much data (in Megabytes) will each %s store?"), 1523 media_descriptor_string(bkpinfo->backup_media_type));1523 bkpinfo->backup_media_string); 1524 1524 1525 1525 if (!popup_and_get_string("Size", comment, sz_size)) { … … 1551 1551 log_msg(1, "bkpinfo->media_device = %s", 1552 1552 bkpinfo->media_device); 1553 tmp = find_cdrom_device(FALSE); 1553 1554 if ((bkpinfo->backup_media_type == dvd) 1554 || ((tmp = find_cdrom_device(FALSE)) != NULL)) { 1555 paranoid_free(bkpinfo->media_device); 1556 bkpinfo->media_device = tmp; 1555 || (tmp != NULL)) { 1556 paranoid_alloc(bkpinfo->media_device, tmp); 1557 1557 log_msg(1, "bkpinfo->media_device = %s", 1558 1558 bkpinfo->media_device); 1559 1559 asprintf(&comment, 1560 1560 _("Please specify your %s drive's /dev entry"), 1561 media_descriptor_string(bkpinfo-> 1562 backup_media_type)); 1561 bkpinfo->backup_media_string); 1563 1562 if (!popup_and_get_string 1564 1563 (_("Device?"), comment, bkpinfo->media_device)) { … … 1568 1567 paranoid_free(comment); 1569 1568 } 1569 paranoid_free(tmp); 1570 1570 1571 log_msg(2, "%s device found at %s", 1571 media_descriptor_string(bkpinfo->backup_media_type),1572 bkpinfo->backup_media_string, 1572 1573 bkpinfo->media_device); 1573 1574 } else { … … 1576 1577 asprintf(&tmp, 1577 1578 _("I think I've found your %s burner at SCSI node %s; am I right on the money? Say no if you have an IDE burner and you are running a 2.6 kernel. Instead, specify the IDE burner's /dev address at the next screen."), 1578 media_descriptor_string(bkpinfo-> 1579 backup_media_type), 1579 bkpinfo->backup_media_string, 1580 1580 bkpinfo->media_device); 1581 1581 if (!ask_me_yes_or_no(tmp)) { … … 1628 1628 } else { 1629 1629 if (does_file_exist("/tmp/mondo-restore.cfg")) { 1630 paranoid_free(bkpinfo->media_device); 1630 1631 read_cfg_var("/tmp/mondo-restore.cfg", "media-dev", 1631 1632 bkpinfo->media_device); … … 1639 1640 } 1640 1641 paranoid_free(tmp); 1641 } 1642 if (bkpinfo->media_device == NULL) { 1642 } else { 1643 1643 if (!popup_and_get_string 1644 1644 (_("Device name?"), … … 1677 1677 1678 1678 case nfs: 1679 if (!bkpinfo->nfs_mount[0]) { 1680 strcpy(bkpinfo->nfs_mount, 1681 call_program_and_get_last_line_of_output 1682 ("mount | grep \":\" | cut -d' ' -f1 | head -n1")); 1679 if (bkpinfo->nfs_mount == NULL) { 1680 bkpinfo->nfs_mount = call_program_and_get_last_line_of_output 1681 ("mount | grep \":\" | cut -d' ' -f1 | head -n1"); 1683 1682 } 1684 1683 #ifdef __FreeBSD__ … … 1704 1703 // check whether already mounted - we better remove 1705 1704 // surrounding spaces and trailing '/' for this 1705 /* BERLIOS: Useless 1706 1706 strip_spaces(bkpinfo->nfs_mount); 1707 */ 1707 1708 if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/') 1708 1709 bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0'; 1709 1710 asprintf(&command, "mount | grep \"%s \" | cut -d' ' -f3", 1710 1711 bkpinfo->nfs_mount); 1711 strcpy(bkpinfo->isodir,1712 call_program_and_get_last_line_of_output(command));1712 paranoid_free(bkpinfo->isodir); 1713 bkpinfo->isodir = call_program_and_get_last_line_of_output(command); 1713 1714 paranoid_free(command); 1714 1715 … … 1738 1739 } 1739 1740 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 1740 sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d", 1741 paranoid_free(bkpinfo->isodir); 1742 asprintf(&bkpinfo->isodir, "/tmp/isodir.mondo.%d", 1741 1743 (int) (random() % 32768)); 1742 1744 asprintf(&command, "mkdir -p %s", bkpinfo->isodir); … … 1748 1750 run_program_and_log_output(tmp, 5); 1749 1751 paranoid_free(tmp); 1750 malloc_string(g_selfmounted_isodir); 1751 strcpy(g_selfmounted_isodir, bkpinfo->isodir); 1752 asprintf(&g_selfmounted_isodir, bkpinfo->isodir); 1752 1753 } 1753 1754 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { … … 1845 1846 if (archiving_to_media) { 1846 1847 1848 if (bkpinfo->boot_device) { 1849 paranoid_free(bkpinfo->boot_device); 1850 } 1847 1851 #ifdef __FreeBSD__ 1848 1852 bkpinfo->boot_device = call_program_and_get_last_line_of_output 1849 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'") );1853 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"); 1850 1854 #else 1851 1855 bkpinfo->boot_device = call_program_and_get_last_line_of_output 1852 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'") );1856 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"); 1853 1857 #endif 1854 1858 i = which_boot_loader(bkpinfo->boot_device); … … 1989 1993 log_it("media device = %s", bkpinfo->media_device); 1990 1994 log_it("media size = %ld", bkpinfo->media_size[1]); 1991 log_it("media type = %s", 1992 bkptype_to_string(bkpinfo->backup_media_type));1995 log_it("media type = %s", bkpinfo->backup_media_string); 1996 paranoid_free(tmp); 1993 1997 log_it("prefix = %s", bkpinfo->prefix); 1994 1998 log_it("compression = %ld", bkpinfo->compression_level); … … 1999 2003 log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device, 2000 2004 bkpinfo->boot_loader); 2001 log_it("prefix = %s", bkpinfo->prefix);2002 2005 if (bkpinfo->media_size[0] < 0) { 2003 2006 if (archiving_to_media) { … … 2033 2036 2034 2037 /** 2035 * Create a randomly-named FIFO. The format is @p stub "." [random] [random] where2036 * [random] is a random number between 1 and 32767.2037 * @param store_name_here Where to store the new filename.2038 * @param stub A random number will be appended to this to make the FIFO's name.2039 * @ingroup deviceGroup2040 */2041 void make_fifo(char *store_name_here, char *stub)2042 {2043 char *tmp;2044 2045 assert_string_is_neither_NULL_nor_zerolength(stub);2046 2047 sprintf(store_name_here, "%s%d%d", stub, (int) (random() % 32768),2048 (int) (random() % 32768));2049 make_hole_for_file(store_name_here);2050 mkfifo(store_name_here, S_IRWXU | S_IRWXG);2051 asprintf(&tmp, "chmod 770 %s", store_name_here);2052 paranoid_system(tmp);2053 paranoid_free(tmp);2054 }2055 2056 2057 /**2058 2038 * Set the tmpdir and scratchdir to reside on the partition with the most free space. 2059 2039 * Automatically excludes DOS, NTFS, SMB, and NFS filesystems. … … 2087 2067 } 2088 2068 i = (int) (random() % 32768); 2069 paranoid_free(bkpinfo->tmpdir); 2089 2070 asprintf(&bkpinfo->tmpdir, "%s/mondo.tmp.%d", tmp, i); 2090 2071 log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir); 2091 2072 2073 paranoid_free(bkpinfo->scratchdir); 2092 2074 asprintf(&bkpinfo->scratchdir, "%s/mondo.scratch.%d", tmp, i); 2093 2075 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); … … 2277 2259 2278 2260 char which_boot_loader(char *which_device) 2261 /* which_device is allocated here and needs to be freed by caller */ 2279 2262 { 2280 2263 /*@ buffer ***************************************************** */ … … 2315 2298 if (does_string_exist_in_boot_block(current_drive, "GRUB")) { 2316 2299 count_grubs++; 2317 strcpy(which_device,current_drive);2300 paranoid_alloc(which_device,current_drive); 2318 2301 break; 2319 2302 } 2320 2303 if (does_string_exist_in_boot_block(current_drive, "LILO")) { 2321 2304 count_lilos++; 2322 strcpy(which_device,current_drive);2305 paranoid_alloc(which_device,current_drive); 2323 2306 break; 2324 2307 } 2325 2308 } 2326 paranoid_free(current_drive);2327 2309 2328 2310 if (pclose(pdrives)) { -
trunk/mondo/mondo/common/libmondo-devices.h
r171 r783 7 7 int does_partition_exist(const char *drive, int partno); 8 8 bool does_string_exist_in_boot_block(char *dev, char *str); 9 intfind_and_mount_actual_cd(struct s_bkpinfo *bkpinfo, char *mountpoint);9 bool find_and_mount_actual_cd(struct s_bkpinfo *bkpinfo, char *mountpoint); 10 10 char *find_cdrom_device(bool try_to_mount); 11 11 char *find_dvd_device(void); … … 28 28 29 29 30 31 void make_fifo(char *store_name_here, char *stub);32 30 33 31 void insist_on_this_cd_number(struct s_bkpinfo *bkpinfo, … … 58 56 59 57 char *which_partition_format(const char *drive); 58 char *bkptype_to_string(t_bkptype bt); -
trunk/mondo/mondo/common/libmondo-filelist.c
r729 r783 266 266 i = 0; 267 267 } 268 /* BERLIOS: Useless with getline269 if (i > MAX_STR_LEN - 1) {270 incoming[MAX_STR_LEN - 30] = '\0';271 log_msg(1, "Warning - truncating file %s's name", incoming);272 err++;273 }274 */275 268 if (incoming[i] < 32) { 276 269 incoming[i] = '\0'; … … 717 710 { 718 711 /*@ buffers ***************************************************** */ 719 char val_sz[MAX_STR_LEN];720 char *cfg_fname ;712 char *val_sz = NULL; 713 char *cfg_fname = NULL; 721 714 722 715 /*@ long ******************************************************** */ 723 int val_i ;716 int val_i = 0; 724 717 725 718 /*@ end vars **************************************************** */ … … 730 723 read_cfg_var(cfg_fname, "last-filelist-number", val_sz); 731 724 val_i = atoi(val_sz); 725 paranoid_free(val_sz); 726 732 727 if (val_i <= 0) { 733 728 val_i = 500; … … 1356 1351 asprintf(&tmp, 1357 1352 "find %s -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o -path /sys -prune -o -path /dev/shm -prune -o -path /media/floppy -prune -o -type d -a -print > %s 2> /dev/null", 1358 dir, MAX_SKEL_DEPTH, g_skeleton_filelist);1353 dir, MAX_SKEL_DEPTH, skeleton_filelist); 1359 1354 #else 1360 1355 // On BSD, for example, /sys is the kernel sources -- don't exclude 1361 1356 asprintf(&tmp, 1362 1357 "find %s -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o -type d -a -print > %s 2> /dev/null", 1363 dir, MAX_SKEL_DEPTH, g_skeleton_filelist);1358 dir, MAX_SKEL_DEPTH, skeleton_filelist); 1364 1359 #endif 1365 1360 system(tmp); … … 1435 1430 /* BERLIOS: Old code 1436 1431 new_with_spaces[0] = ' '; 1437 str cpy(new_with_spaces + 1, new);1438 str cat(new_with_spaces, " ");1432 str-cpy(new_with_spaces + 1, new); 1433 str-cat(new_with_spaces, " "); 1439 1434 */ 1440 1435 if (strstr(skip_these, new_with_spaces)) { … … 1504 1499 { 1505 1500 static char sz_res[MAX_STR_LEN]; 1506 char *p ;1501 char *p = NULL; 1507 1502 bool in_quotes = FALSE; 1508 1503 -
trunk/mondo/mondo/common/libmondo-files-EXT.h
r687 r783 7 7 extern unsigned int updcrcr(unsigned int crc, unsigned int c); 8 8 extern char *calc_checksum_of_file(char *filename); 9 extern char *calc_file_ugly_minichecksum(char *curr_fname);10 9 extern long count_lines_in_file(char *filename); 11 10 extern bool does_file_exist(char *filename); -
trunk/mondo/mondo/common/libmondo-files.c
r764 r783 25 25 26 26 extern int g_currentY; 27 extern int g_noof_log_lines; 27 28 extern char *g_mondo_home; 28 29 … … 77 78 } 78 79 return (output); 79 }80 81 82 /**83 * Get a not-quite-unique representation of some of the file's @c stat properties.84 * The returned string has the form <tt>size-mtime-ctime</tt>.85 * @param curr_fname The file to generate the "checksum" for.86 * @return The "checksum".87 * @note The returned string points to static storage that will be overwritten with each call.88 */89 char *calc_file_ugly_minichecksum(char *curr_fname)90 {91 92 /*@ buffers ***************************************************** */93 char *curr_cksum;94 95 /*@ pointers **************************************************** */96 97 /*@ structures ************************************************** */98 struct stat buf;99 100 /*@************************************************************** */101 102 assert_string_is_neither_NULL_nor_zerolength(curr_fname);103 if (lstat(curr_fname, &buf)) {104 asprintf(&curr_cksum, "");105 } else {106 asprintf(&curr_cksum, "%ld-%ld-%ld", (long) (buf.st_size),107 (long) (buf.st_mtime), (long) (buf.st_ctime));108 }109 return (curr_cksum);110 80 } 111 81 … … 275 245 if (kernel == NULL) { 276 246 kernel = call_program_and_get_last_line_of_output 277 ("mindi --findkernel 2> /dev/null") );247 ("mindi --findkernel 2> /dev/null"); 278 248 } 279 249 // If we didn't get anything back, check whether mindi raised a fatal error … … 481 451 log_it(tmp); 482 452 paranoid_free(tmp); 483 asprintf(&output, ""); 484 485 return (output); 453 return (NULL); 486 454 } 487 455 asprintf(&command, "tail -n1 %s", filename); … … 1033 1001 paranoid_free(command); 1034 1002 1035 if (bkpinfo->postnuke_tarball [0]) {1003 if (bkpinfo->postnuke_tarball) { 1036 1004 asprintf(&command, "cp -f %s %s/post-nuke.tgz", 1037 1005 bkpinfo->postnuke_tarball, bkpinfo->tmpdir); … … 1187 1155 { 1188 1156 /*@ buffers *************** */ 1189 char *tmp ;1157 char *tmp = NULL; 1190 1158 1191 1159 /*@ long long ************* */ … … 1214 1182 asprintf(&tmp, 1215 1183 _("Your backup will probably occupy a single %s. Maybe two."), 1216 media_descriptor_string(bkpinfo->backup_media_type));1184 bkpinfo->backup_media_string); 1217 1185 } else { 1218 1186 asprintf(&tmp, _("Your backup will occupy approximately %s media."), 1219 1187 number_to_text((int) (scratchLL + 1))); 1220 1188 } 1221 if (!bkpinfo->image_devs [0]&& (scratchLL < 50)) {1189 if (!bkpinfo->image_devs && (scratchLL < 50)) { 1222 1190 log_to_screen(tmp); 1223 1191 } … … 1235 1203 bool is_this_file_compressed(char *filename) 1236 1204 { 1237 char *do_not_compress_these ;1238 char *tmp ;1239 char *p ;1205 char *do_not_compress_these = NULL; 1206 char *tmp = NULL; 1207 char *p = NULL; 1240 1208 1241 1209 asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home); -
trunk/mondo/mondo/common/libmondo-files.h
r687 r783 9 9 unsigned int updcrcr(unsigned int crc, unsigned int c); 10 10 char *calc_checksum_of_file(char *filename); 11 char *calc_file_ugly_minichecksum(char *curr_fname);12 char *calc_file_ugly_minichecksum(char *curr_fname);13 11 long count_lines_in_file(char *filename); 14 12 bool does_file_exist(char *filename); -
trunk/mondo/mondo/common/libmondo-fork.c
r689 r783 11 11 #include "libmondo-tools-EXT.h" 12 12 13 extern char *g_tmpfs_mountpt;14 extern t_bkptype g_backup_media_type;15 13 extern bool g_text_mode; 16 14 pid_t g_buffer_pid = 0; … … 107 105 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", 108 106 what_i_am_doing); 109 strcpy(tmp, command);110 107 if (bkpinfo->manual_cd_tray) { 111 p = strstr(tmp, "2>>"); 108 /* Find everything after a 2>> and remove it */ 109 p = strstr(command, "2>>"); 112 110 if (p) { 113 sprintf(p, " "); 114 while (*p == ' ') { 115 p++; 116 } 117 for (; *p != ' '; p++) { 111 for (; *p != ' ' && *p != '\0'; p++) { 118 112 *p = ' '; 119 113 } 120 114 } 121 paranoid_free(command);122 asprintf(&command, tmp);123 115 #ifndef _XWIN 124 116 if (!g_text_mode) { … … 164 156 { 165 157 /*@ buffer ****************************************************** */ 166 char *callstr ;158 char *callstr = NULL; 167 159 char *incoming = NULL; 168 char tmp[MAX_STR_LEN * 2];169 160 170 161 /*@ int ********************************************************* */ 171 int res; 172 int i; 162 int res = 0; 173 163 size_t n = 0; 174 int len;175 164 bool log_if_failure = FALSE; 176 165 bool log_if_success = FALSE; … … 203 192 204 193 205 len = (int) strlen(program);206 for (i = 0; i < 35 - len / 2; i++) {207 tmp[i] = '-';208 }209 tmp[i] = '\0';210 strcat(tmp, " ");211 strcat(tmp, program);212 strcat(tmp, " ");213 for (i = 0; i < 35 - len / 2; i++) {214 strcat(tmp, "-");215 }216 194 res = system(callstr); 217 195 if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) { … … 361 339 // if dir=='w' then copy from orig to archived 362 340 // if dir=='r' then copy from archived to orig 363 char *tmp ;364 char *buf ;341 char *tmp = NULL; 342 char *buf = NULL; 365 343 long int bytes_to_be_read, bytes_read_in, bytes_written_out = 366 344 0, bufcap, subsliceno = 0; 367 345 int retval = 0; 368 FILE *fin ;369 FILE *fout ;370 FILE *ftmp ;346 FILE *fin = NULL; 347 FILE *fout = NULL; 348 FILE *ftmp = NULL; 371 349 372 350 log_msg(5, "Opening."); … … 439 417 } 440 418 bytes_written_out += fwrite(buf, 1, bytes_read_in, fout); 441 if (fread(tmp, 1, 64 , fin) != 64) {419 if (fread(tmp, 1, 64L, fin) != 64L) { 442 420 fatal_error("Cannot read post-thingy block"); 443 421 } … … 448 426 log_msg(7, "Subslice #%ld read OK", subsliceno); 449 427 subsliceno++; 450 if (fread(tmp, 1, 64 , fin) != 64) {428 if (fread(tmp, 1, 64L, fin) != 64L) { 451 429 fatal_error("Cannot read introductory block"); 452 430 } … … 458 436 459 437 if (direction == 'w') { 438 paranoid_free(tmp); 460 439 asprintf(&tmp, "%-64s", PIMP_END_SZ); 461 if (fwrite(tmp, 1, 64 , fout) != 64) {440 if (fwrite(tmp, 1, 64L, fout) != 64L) { 462 441 fatal_error("Can't write the final block"); 463 442 } … … 466 445 log_msg(1, "tmpA is %s", tmp); 467 446 if (!strstr(tmp, PIMP_END_SZ)) { 468 if (fread(tmp, 1, 64 , fin) != 64) {447 if (fread(tmp, 1, 64L, fin) != 64L) { 469 448 fatal_error("Can't read the final block"); 470 449 } … … 472 451 if (!strstr(tmp, PIMP_END_SZ)) { 473 452 ftmp = fopen("/tmp/out.leftover", "w"); 474 bytes_read_in = fread(tmp, 1, 64 , fin);453 bytes_read_in = fread(tmp, 1, 64L, fin); 475 454 log_msg(1, "bytes_read_in = %ld", bytes_read_in); 476 455 // if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); } 477 456 fwrite(tmp, 1, bytes_read_in, ftmp); 457 478 458 paranoid_free(tmp); 479 480 459 if (!(tmp = malloc(512))) { 481 460 fatal_error("Failed to malloc() tmp"); 482 461 } 483 462 /* BERLIOS : strange ??? 484 s printf(tmp, "I am here - %llu", ftello(fin));485 log_msg(0, tmp);486 */463 s-printf(tmp, "I am here - %llu", ftello(fin)); 464 log_msg(0, tmp); 465 */ 487 466 fread(tmp, 1, 512, fin); 488 467 log_msg(0, "tmp = '%s'", tmp); … … 571 550 if (pcno <= 5 && last_pcno > 40) { 572 551 close_evalcall_form(); 573 open_evalcall_form("_(Verifying...") );552 open_evalcall_form("_(Verifying..."); 574 553 } 575 554 last_pcno = pcno; -
trunk/mondo/mondo/common/libmondo-mountlist.c
r688 r783 63 63 char *tmp1 = NULL; 64 64 char *device = NULL; 65 char *ndevice = NULL; 65 66 // BERLIOS : useless ? char *mountpoint; 66 67 … … 203 204 npos = 0; 204 205 for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) { 205 sprintf(device, "%ss%i%c", device, curr_part_no, cur_sp_no);206 if (find_device_in_mountlist(mountlist, device) >= 0)206 asprintf(&ndevice, "%ss%d%c", device, curr_part_no, cur_sp_no); 207 if (find_device_in_mountlist(mountlist, ndevice) >= 0) 207 208 npos++; 209 paranoid_free(ndevice); 208 210 } 209 211 paranoid_free(device); … … 500 502 501 503 /*@ buffers ******************************************************** */ 502 char *tmp; 503 char *device; 504 char *tmp = NULL; 505 char *tmp1 = NULL; 506 char *device = NULL; 504 507 505 508 /*@ long *********************************************************** */ 506 long physical_drive_size = 0 ;507 long amount_allocated = 0 ;509 long physical_drive_size = 0L; 510 long amount_allocated = 0L; 508 511 509 512 /*@ pointers ******************************************************* */ 510 char *part_table_fmt ;513 char *part_table_fmt = NULL; 511 514 512 515 /*@ initialize ***************************************************** */ … … 559 562 continue; 560 563 } 561 // BERLIOS : useless ? str cpy(mountpoint, mountlist->el[pos].mountpoint);564 // BERLIOS : useless ? str-cpy(mountpoint, mountlist->el[pos].mountpoint); 562 565 /* gap in the partition list? */ 563 566 if (curr_part_no - prev_part_no > 1) { … … 751 754 drivelist = malloc(sizeof(struct list_of_disks)); 752 755 assert(mountlist != NULL); 753 assert(flaws_str_A != NULL);754 assert(flaws_str_B != NULL);755 assert(flaws_str_C != NULL);756 756 757 757 asprintf(&flaws_str, " "); -
trunk/mondo/mondo/common/libmondo-msg.c
r537 r783 14 14 * The default maximum level to log messages at or below. 15 15 */ 16 int g_loglevel = DEFAULT_DEBUG_LEVEL;16 extern int g_loglevel; 17 17 18 18 /** -
trunk/mondo/mondo/common/libmondo-raid.c
r689 r783 9 9 10 10 #include "my-stuff.h" 11 #include "mr_string.h" 11 12 #include "mondostructures.h" 12 13 #include "newt-specific-EXT.h" … … 177 178 { 178 179 /*@ buffers ***************************************************** */ 179 char *sz_value; 180 char *sz_value = NULL; 181 char *sz_label = NULL; 180 182 181 183 assert(raidrec != NULL); … … 183 185 184 186 asprintf(&sz_value, "%d", value); 185 strcpy(raidrec->additional_vars.el[lino].label,label);186 strcpy(raidrec->additional_vars.el[lino].value, sz_value);187 paranoid_free(sz_value);187 asprintf(&sz_label,label); 188 raidrec->additional_vars.el[lino].value = sz_value; 189 raidrec->additional_vars.el[lino].label = sz_label; 188 190 } 189 191 #endif … … 956 958 // trim leading spaces 957 959 pos = string; 958 while (*pos == ' ') pos += 1;960 while (*pos == ' ') pos++; 959 961 asprintf(&strtmp, pos); 960 strcpy(string,strtmp);962 paranoid_alloc(string,strtmp); 961 963 paranoid_free(strtmp); 962 964 // if we have newline after only spaces, this is a blank line, update … … 979 981 // get RAID device name 980 982 asprintf(&strtmp,"%s%s", device_prefix, token); 981 strcpy(raidlist->el[raidlist->entries].raid_device, strtmp); 982 paranoid_free(strtmp); 983 raidlist->el[raidlist->entries].raid_device = strtmp; 983 984 paranoid_free(token); 984 985 // skip ':' and status -
trunk/mondo/mondo/common/libmondo-stream.c
r689 r783 543 543 544 544 545 /**546 * FIFO used to read/write to the tape device.547 * @bug This seems obsolete now that we call an external @c buffer program. Please look onto this.548 */549 char g_tape_fifo[MAX_STR_LEN];550 551 545 int set_tape_block_size_with_mt(char *tapedev, 552 546 long internal_tape_block_size) … … 622 616 open_device_via_buffer(bkpinfo->media_device, 'r', 623 617 bkpinfo->internal_tape_block_size))) { 624 log_OS_error(g_tape_fifo);625 618 log_to_screen(_("Cannot openin stream device")); 626 619 return (1); … … 748 741 (g_tape_stream = 749 742 open_device_via_buffer(tapedev, 'w', internal_tape_block_size))) { 750 log_OS_error(g_tape_fifo);751 743 log_to_screen(_("Cannot openin stream device")); 752 744 return (1); … … 1249 1241 open_device_via_buffer(bkpinfo->media_device, 'r', 1250 1242 bkpinfo->internal_tape_block_size))) { 1251 log_OS_error(g_tape_fifo);1252 1243 log_to_screen(_("Cannot openin stream device")); 1253 1244 return (1); … … 1309 1300 open_device_via_buffer(bkpinfo->media_device, 'w', 1310 1301 bkpinfo->internal_tape_block_size))) { 1311 log_OS_error(g_tape_fifo);1312 1302 log_to_screen(_("Cannot openin stream device")); 1313 1303 return (1); -
trunk/mondo/mondo/common/libmondo-string-EXT.h
r588 r783 3 3 */ 4 4 5 extern char *build_partition_name(char *partition, const char *drive, 6 int partno); 5 extern char *build_partition_name(const char *drive, int partno); 7 6 extern void center_string(char *in_out, int width); 8 7 extern char *commarize(char *); … … 44 43 extern inline void turn_wildcard_chars_into_literal_chars(char *out, 45 44 char *in); 46 /* Valid external functions */47 extern char *mr_strtok(char *instr, const char *delims, int *lastpos); -
trunk/mondo/mondo/common/libmondo-string.c
r768 r783 14 14 #include "newt-specific-EXT.h" 15 15 #include "libmondo-tools-EXT.h" 16 #include <math.h> 16 17 17 18 /*@unused@*/ … … 136 137 137 138 138 /*139 * Add commas every third place in @p input.140 * @param input The string to commarize.141 * @return The string with commas.142 * @note The returned string points to static storage that will be overwritten with each call.143 */144 char *commarize(char *input)145 {146 char *pos_w_commas;147 static char output[MAX_STR_LEN];148 char *tmp;149 int j;150 151 assert(input != NULL);152 153 asprintf(&tmp, "%s", input);154 if (strlen(tmp) > 6) {155 asprintf(&pos_w_commas, "%s", tmp);156 j = (int) strlen(pos_w_commas);157 tmp[j - 6] = ',';158 strcpy(tmp + j - 5, pos_w_commas + j - 6);159 paranoid_free(pos_w_commas);160 asprintf(&pos_w_commas, "%s", tmp);161 }162 if (strlen(tmp) > 3) {163 j = (int) strlen(tmp);164 asprintf(&pos_w_commas, "%s", tmp);165 pos_w_commas[j - 3] = ',';166 strcpy(pos_w_commas + j - 2, tmp + j - 3);167 } else {168 asprintf(&pos_w_commas, "%s", tmp);169 }170 strcpy(output, pos_w_commas);171 paranoid_free(pos_w_commas);172 paranoid_free(tmp);173 return (output);174 }175 176 177 139 /** 178 140 * Turn an entry from the RAID editor's disklist into a GUI-friendly string. … … 601 563 602 564 /*@ initialize ****************************************************** */ 603 assert(flaws_str_A != NULL);604 assert(flaws_str_B != NULL);605 assert(flaws_str_C != NULL);606 565 assert(flaws_str != NULL); 607 566 608 flaws_str_A[0] = flaws_str_B[0] = flaws_str_C[0] = '\0'; 609 567 flaws_str_A = NULL; 568 flaws_str_B = NULL; 569 flaws_str_C = NULL; 610 570 611 571 if (!res && !strlen(flaws_str)) { … … 613 573 } 614 574 if (strlen(flaws_str) > 0) { 615 sprintf(flaws_str_A, "%s", flaws_str + 1);575 asprintf(&flaws_str_A, "%s", flaws_str + 1); 616 576 } 617 577 if (strlen(flaws_str_A) >= 74) { 618 578 for (i = 74; flaws_str_A[i] != ' '; i--); 619 strcpy(flaws_str_B, flaws_str_A + i + 1);579 asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1); 620 580 flaws_str_A[i] = '\0'; 621 581 } 622 582 if (strlen(flaws_str_B) >= 74) { 623 583 for (i = 74; flaws_str_B[i] != ' '; i--); 624 strcpy(flaws_str_C, flaws_str_B + i + 1);584 asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1); 625 585 flaws_str_B[i] = '\0'; 626 586 } … … 834 794 if (c && strncmp(c, "/part", 5) == 0) { 835 795 /* yup it's devfs, return the "disc" path */ 836 str cpy(c + 1, "disc");796 strncpy(c + 1, "disc", (size_t)5); 837 797 return partition; 838 798 } … … 1027 987 /*@ int *********************************************** */ 1028 988 int percentage = 0; 1029 int i ;1030 int j ;989 int i = 0; 990 int j = 0; 1031 991 1032 992 /*@ buffers ******************************************* */ 1033 char *outstr; 1034 char *tmp; 1035 char *tmp1; 1036 char *tmp2; 1037 char *prepstr; 1038 char *p; 993 char *outstr = NULL; 994 char *tmp1 = NULL; 995 char *tmp2 = NULL; 996 char *prepstr = NULL; 997 char *p = NULL; 1039 998 1040 999 assert(bkpinfo != NULL); 1041 1000 1042 1001 if (bkpinfo->media_size[g_current_media_number] <= 0) { 1043 asprintf(&tmp, "%lld", g_tape_posK); 1044 asprintf(&outstr, _("Volume %d: %s kilobytes archived so far"), 1045 g_current_media_number, commarize(tmp)); 1046 paranoid_free(tmp); 1002 asprintf(&outstr, _("Volume %d: %'lld kilobytes archived so far"), 1003 g_current_media_number, g_tape_posK); 1047 1004 1048 1005 return (outstr); … … 1060 1017 bkpinfo->media_size[g_current_media_number]); 1061 1018 asprintf(&prepstr, "%s %d: [", 1062 media_descriptor_string(bkpinfo->backup_media_type),1019 bkpinfo->backup_media_string, 1063 1020 g_current_media_number); 1064 1021 } … … 1093 1050 return (outstr); 1094 1051 } 1095 1096 /**1097 * Get a string form of @p type_of_bkp.1098 * @param type_of_bkp The backup type to stringify.1099 * @return The stringification of @p type_of_bkp.1100 * @note The returned string points to static storage that will be overwritten with each call.1101 */1102 char *media_descriptor_string(t_bkptype type_of_bkp)1103 {1104 static char *type_of_backup = NULL;1105 1106 if (!type_of_backup) {1107 malloc_string(type_of_backup);1108 }1109 1110 switch (type_of_bkp) {1111 case dvd:1112 strcpy(type_of_backup, "DVD");1113 break;1114 case cdr:1115 strcpy(type_of_backup, "CDR");1116 break;1117 case cdrw:1118 strcpy(type_of_backup, "CDRW");1119 break;1120 case tape:1121 strcpy(type_of_backup, "tape");1122 break;1123 case cdstream:1124 strcpy(type_of_backup, "CDR");1125 break;1126 case udev:1127 strcpy(type_of_backup, "udev");1128 break;1129 case iso:1130 strcpy(type_of_backup, "ISO");1131 break;1132 case nfs:1133 strcpy(type_of_backup, "nfs");1134 break;1135 default:1136 strcpy(type_of_backup, "ISO");1137 }1138 return (type_of_backup);1139 } -
trunk/mondo/mondo/common/libmondo-string.h
r588 r783 3 3 */ 4 4 5 char *build_partition_name(c har *partition, const char *drive, int partno);5 char *build_partition_name(const char *drive, int partno); 6 6 void center_string(char *in_out, int width); 7 7 char *commarize(char *); … … 34 34 char *media_descriptor_string(t_bkptype); 35 35 inline void turn_wildcard_chars_into_literal_chars(char *out, char *in); 36 37 /* Valid external functions */38 char *mr_strtok(char *instr, const char *delims, int *lastpos); -
trunk/mondo/mondo/common/libmondo-tools.c
r689 r783 74 74 75 75 extern t_bkptype g_backup_media_type; 76 extern char *g_backup_media_string; 76 77 77 78 extern bool am_I_in_disaster_recovery_mode(void); … … 281 282 { 282 283 assert(raidrec != NULL); 283 raidrec->raid_device [0] = '\0';284 raidrec->raid_device = NULL; 284 285 raidrec->raid_level = -9; 285 286 raidrec->persistent_superblock = 1; … … 356 357 char *tmp = NULL; 357 358 char *tmp1 = NULL; 358 char call_before_iso_user[MAX_STR_LEN] = "\0";359 char *call_before_iso_user = NULL; 359 360 int rdsiz_MB; 360 361 char *iso_path = NULL; … … 415 416 if (avm / 1024 > rdsiz_MB * 3) { 416 417 if (run_program_and_log_output(command, 5)) { 417 g_tmpfs_mountpt[0] = '\0';418 paranoid_free(g_tmpfs_mountpt); 418 419 log_it("Failed to mount tmpfs"); 419 420 } else { … … 421 422 } 422 423 } else { 423 g_tmpfs_mountpt[0] = '\0';424 paranoid_free(g_tmpfs_mountpt); 424 425 log_it("It doesn't seem you have enough swap to use tmpfs. Fine."); 425 426 } … … 427 428 428 429 if (bkpinfo->use_lzo) { 429 strcpy(bkpinfo->zip_exe, "lzop");430 strcpy(bkpinfo->zip_suffix, "lzo");430 paranoid_alloc(bkpinfo->zip_exe, "lzop"); 431 paranoid_alloc(bkpinfo->zip_suffix, "lzo"); 431 432 } else if (bkpinfo->compression_level != 0) { 432 strcpy(bkpinfo->zip_exe, "bzip2");433 strcpy(bkpinfo->zip_suffix, "bz2");433 paranoid_alloc(bkpinfo->zip_exe, "bzip2"); 434 paranoid_alloc(bkpinfo->zip_suffix, "bz2"); 434 435 } else { 435 bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0'; 436 bkpinfo->zip_exe = NULL; 437 bkpinfo->zip_suffix = NULL; 436 438 } 437 439 … … 470 472 // -m isn't supported by growisofs, BTW... 471 473 } else { 472 sprintf(bkpinfo->call_make_iso,474 asprintf(&bkpinfo->call_make_iso, 473 475 "%s %s -Z %s . 2>> _ERR_", 474 476 mondo_mkisofs_sz, "", bkpinfo->media_device); … … 518 520 519 521 if (bkpinfo->nonbootable_backup) { 520 asprintf(&mondo_mkisofs_sz, "%s -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_", mrconf->mondo_iso_creation_cmd);522 asprintf(&mondo_mkisofs_sz, "%s -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_", bkpinfo->mr_conf->mondo_iso_creation_cmd); 521 523 } else if 522 524 #ifdef __FreeBSD__ … … 539 541 } 540 542 if (bkpinfo->manual_cd_tray) { 541 if (bkpinfo->call_before_iso [0] == '\0') {542 sprintf(bkpinfo->call_before_iso,543 if (bkpinfo->call_before_iso == NULL) { 544 asprintf(&bkpinfo->call_before_iso, 543 545 "%s -o %s/temporary.iso . 2>> _ERR_", 544 546 mondo_mkisofs_sz, bkpinfo->tmpdir); 545 546 strncpy(call_before_iso_user, bkpinfo->call_before_iso, MAX_STR_LEN);547 sprintf (bkpinfo->call_before_iso,547 } else { 548 asprintf(&call_before_iso_user, bkpinfo->call_before_iso); 549 asprintf(&bkpinfo->call_before_iso, 548 550 "( %s -o %s/temporary.iso . 2>> _ERR_ ; %s )", 549 551 mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user); 552 paranoid_free(call_before_iso_user); 550 553 } 551 554 log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso); 552 sprintf(bkpinfo->call_make_iso,555 asprintf(&bkpinfo->call_make_iso, 553 556 "%s %s -v %s fs=4m dev=%s speed=%d %s/temporary.iso", 554 557 cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", … … 556 559 bkpinfo->cdrw_speed, bkpinfo->tmpdir); 557 560 } else { 558 sprintf(bkpinfo->call_make_iso,561 asprintf(&bkpinfo->call_make_iso, 559 562 "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", 560 563 mondo_mkisofs_sz, cdr_exe, … … 641 644 h_addr)), 642 645 strchr(bkpinfo->nfs_mount, ':')); 643 strcpy(bkpinfo->nfs_mount, ip_address);646 paranoid_alloc(bkpinfo->nfs_mount, ip_address); 644 647 paranoid_free(ip_address); 645 648 } … … 663 666 retval++; 664 667 } 665 if (bkpinfo->include_paths [0] == '\0') {668 if (bkpinfo->include_paths == NULL) { 666 669 // fatal_error ("Why no backup path?"); 667 strcpy(bkpinfo->include_paths, "/");670 asprintf(&bkpinfo->include_paths, "/"); 668 671 } 669 672 chmod(bkpinfo->scratchdir, 0700); 670 673 chmod(bkpinfo->tmpdir, 0700); 671 674 g_backup_media_type = bkpinfo->backup_media_type; 675 paranoid_alloc(g_backup_media_string,bkpinfo->backup_media_string); 672 676 return (retval); 673 677 } … … 712 716 g_current_media_number = 1; 713 717 bkpinfo->postnuke_tarball = NULL; 714 bkpinfo->nfs_mount = NULL;718 paranoid_free(bkpinfo->nfs_mount); 715 719 return (res); 716 720 } … … 748 752 paranoid_free(bkpinfo->restore_path); 749 753 bkpinfo->use_lzo = FALSE; 750 paranoid_free(bkpinfo->do_not_compress_these);751 754 bkpinfo->verify_data = FALSE; 752 755 bkpinfo->backup_data = FALSE; … … 767 770 bkpinfo->optimal_set_size = 0; 768 771 bkpinfo->backup_media_type = none; 772 paranoid_free(bkpinfo->backup_media_string); 769 773 paranoid_alloc(bkpinfo->include_paths, "/"); 770 774 paranoid_free(bkpinfo->exclude_paths); … … 1043 1047 value = NULL; 1044 1048 return (1); 1045 } else if (strstr(value, "/dev/") && strstr(value, "t0") 1049 /* } BERLIOS: Useless: 1050 else if (strstr(value, "/dev/") && strstr(value, "t0") 1046 1051 && !strcmp(label, "media-dev")) { 1047 1052 log_msg(2, "FYI, I shan't read new value for %s - already got %s", 1048 1053 label, value); 1049 1054 return (0); 1050 } else {1055 */ } else { 1051 1056 asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", 1052 1057 label, config_file); … … 1102 1107 1103 1108 log_msg(1, "Started sub"); 1104 log_msg(4, "About to set g_boot_mountpt to \"\""); 1105 asprintf(&g_boot_mountpt, ""); 1106 log_msg(4, "Done. Great. Seeting command to something"); 1109 log_msg(4, "Setting command to something"); 1107 1110 asprintf(&command, 1108 1111 "grep -v \":\" /etc/fstab | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1"); … … 1136 1139 asprintf(&tmp1, "mount %s", g_boot_mountpt); 1137 1140 if (run_program_and_log_output(tmp1, 5)) { 1141 /* BERLIOS: Useless ??? 1138 1142 paranoid_free(g_boot_mountpt); 1139 1143 asprintf(&g_boot_mountpt, " "); 1144 */ 1140 1145 log_msg(1, "Plan B"); 1141 1146 if (!run_program_and_log_output("mount /boot", 5)) { … … 1166 1171 1167 1172 log_msg(3, "starting"); 1168 if (g_boot_mountpt [0]) {1173 if (g_boot_mountpt != NULL) { 1169 1174 asprintf(&tmp, "umount %s", g_boot_mountpt); 1170 1175 if (run_program_and_log_output(tmp, 5)) { -
trunk/mondo/mondo/common/libmondo-verify.c
r688 r783 63 63 sync(); 64 64 65 /* s printf (command,65 /* s-printf (command, 66 66 "grep \"afio: \" %s | awk '{j=substr($0,8); i=index(j,\": \");printf \"/%%s\\n\",substr(j,1,i-2);}' | sort -u | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"/dev/.*\" > %s", 67 67 stderr_fname, afio_found_changes); … … 152 152 } 153 153 asprintf(&tmp, "Verifying %s #%d's tarballs", 154 media_descriptor_string(bkpinfo->backup_media_type),154 bkpinfo->backup_media_string, 155 155 g_current_media_number); 156 156 open_evalcall_form(tmp); … … 187 187 * - @c restore_path 188 188 * - @c use_lzo 189 * - @c zip_exe190 189 * - @c zip_suffix 191 190 * @param mtpt The mountpoint the CD/DVD/ISO is mounted on. … … 245 244 iamhere("before vsbf"); 246 245 asprintf(&tmp, "Verifying %s#%d's big files", 247 media_descriptor_string(bkpinfo->backup_media_type),246 bkpinfo->backup_media_string, 248 247 g_current_media_number); 249 248 open_evalcall_form(tmp); … … 391 390 /*@ long *********************************************************** */ 392 391 long diffs = 0; 393 /* getcwd(old_pwd,MAX_STR_LEN-1); */394 392 395 393 assert(bkpinfo != NULL); … … 405 403 && strcmp(bkpinfo->zip_suffix, "lzo")) { 406 404 log_msg(2, "OK, I'm going to start using lzop."); 407 strcpy(bkpinfo->zip_exe, "lzop");408 strcpy(bkpinfo->zip_suffix, "lzo");405 paranoid_alloc(bkpinfo->zip_exe, "lzop"); 406 paranoid_alloc(bkpinfo->zip_suffix, "lzo"); 409 407 bkpinfo->use_lzo = TRUE; 410 408 } … … 412 410 && strcmp(bkpinfo->zip_suffix, "bz2")) { 413 411 log_msg(2, "OK, I'm going to start using bzip2."); 414 strcpy(bkpinfo->zip_exe, "bzip2");415 strcpy(bkpinfo->zip_suffix, "bz2");412 paranoid_alloc(bkpinfo->zip_exe, "bzip2"); 413 paranoid_alloc(bkpinfo->zip_suffix, "bz2"); 416 414 bkpinfo->use_lzo = FALSE; 417 415 } … … 478 476 479 477 /* chdir(old_pwd); */ 480 // s printf (tmp, "uniq -u %s >> %s", "/tmp/mondo-verify.err", MONDO_LOGFILE);478 // s-printf (tmp, "uniq -u %s >> %s", "/tmp/mondo-verify.err", MONDO_LOGFILE); 481 479 // paranoid_system (tmp); 482 480 // unlink ("/tmp/mondo-verify.err"); -
trunk/mondo/mondo/common/mondostructures.h
r561 r783 88 88 * The label for this RAID variable. 89 89 */ 90 char label[64];90 char *label; 91 91 92 92 /** 93 93 * The value for this RAID variable. 94 94 */ 95 char value[64];95 char *value; 96 96 }; 97 97 … … 214 214 * The name of the RAID device (e.g. /dev/md0). 215 215 */ 216 char raid_device[64];216 char *raid_device; 217 217 218 218 /** … … 303 303 */ 304 304 struct s_bkpinfo { 305 306 /** 307 * Pointer to the configuration structure 308 */ 309 struct s_mr_conf *mr_conf; 310 305 311 /** 306 312 * The device we're backing up to. … … 346 352 * compression_level is 0. 347 353 */ 348 char zip_exe[MAX_STR_LEN / 4];354 char *zip_exe; 349 355 350 356 /** … … 352 358 * bz2, gzip uses gz, etc. Do not include the dot. 353 359 */ 354 char zip_suffix[MAX_STR_LEN / 4];360 char *zip_suffix; 355 361 356 362 /** … … 383 389 384 390 /** 385 * A filename containing a list of extensions, one per line, to not386 * compress. If this is set to "", afio will still exclude a set of well-known387 * compressed files from compression, but biggiefiles that are compressed388 * will be recompressed again.389 */390 char do_not_compress_these[MAX_STR_LEN / 2];391 392 /**393 391 * If TRUE, then we should verify a backup. 394 392 */ … … 465 463 466 464 /** 465 * The string corresponding to the media type 466 */ 467 char *backup_media_string; 468 469 /** 467 470 * Whether we should use a premade filelist or generate our own. 468 471 * If TRUE, then we generate our own filelist from the directories in @p include_paths. … … 476 479 * If you do nothing, "/" will be used. 477 480 */ 478 char include_paths[MAX_STR_LEN*4];481 char *include_paths; 479 482 480 483 /** … … 483 486 * the scratchdir, and the tempdir are automatically excluded. 484 487 */ 485 char exclude_paths[MAX_STR_LEN*4];488 char *exclude_paths; 486 489 487 490 /** … … 490 493 * without overwriting the old ones. Ignored during a backup. 491 494 */ 492 char restore_path[MAX_STR_LEN];495 char *restore_path; 493 496 494 497 /** … … 500 503 * A command to call to make an ISO image. 501 504 */ 502 char call_make_iso[MAX_STR_LEN];505 char *call_make_iso; 503 506 504 507 /** 505 508 * A command to call to burn the ISO image. 506 */ 507 char call_burn_iso[MAX_STR_LEN]; 509 * BERLIOS: Useful ??? 510 */ 511 char *call_burn_iso; 508 512 509 513 /** … … 614 618 bool expanded; 615 619 }; 616 617 618 619 /**620 * A structure to wrap a FIFO device for writing to a tape/CD stream.621 * @bug Is this structure used (w/the move to a standalone @c buffer and all)?622 */623 struct s_wrapfifo {624 /**625 * The device we write to or read from (a FIFO).626 */627 char public_device[MAX_STR_LEN / 4];628 629 /**630 * The actual device that data from the FIFO should be buffered and written to.631 */632 char private_device[MAX_STR_LEN / 4];633 634 /**635 * A buffer for holding data read from the FIFO.636 */637 char internal_buffer_IN_fifo[MAX_STR_LEN / 4];638 639 /**640 * A buffer for holding data to be written to the FIFO.641 */642 char internal_buffer_OUT_fifo[MAX_STR_LEN / 4];643 644 /**645 * If TRUE, then we're writing directly to the tape streamer; if FALSE, we're writing to the FIFO.646 */647 bool writing_to_private_device;648 };649 650 651 620 652 621 /** … … 801 770 }; 802 771 803 struct s_mr conf {804 int ia64_boot_size;805 char * iso_creation_cmd;806 }; 772 struct s_mr_conf { 773 int mindi_ia64_boot_size; 774 char *mondo_iso_creation_cmd; 775 }; -
trunk/mondo/mondo/common/newt-specific.c
r764 r783 14 14 15 15 #include <unistd.h> 16 #include <math.h> 16 17 17 18 #include "my-stuff.h" … … 28 29 //static char cvsid[] = "$Id$"; 29 30 30 31 32 33 34 31 extern pid_t g_mastermind_pid; 32 extern char *g_tmpfs_mountpt; 33 extern char *g_mondo_home; 34 35 extern void set_signals(int); 35 36 36 37 /** … … 41 42 * Whether we are currently in a nested call of fatal_error(). 42 43 */ 43 44 45 46 47 48 49 50 51 52 44 bool g_exiting = FALSE; 45 46 newtComponent g_timeline = NULL, ///< The line of the progress form that shows the time elapsed/remaining 47 g_percentline = NULL, ///< The line of the progress form that shows the percent completed/remaining 48 g_scale = NULL, ///< The progress bar component in the progress form 49 g_progressForm = NULL, ///< The progress form component itself 50 g_blurb1 = NULL, ///< The component for line 1 of the blurb in the progress form 51 g_blurb2 = NULL, ///< The component for line 2 of the blurb in the progress form 52 g_blurb3 = NULL, ///< The component for line 3 (updated continuously) of the blurb in the progress form 53 g_label = NULL; ///< ????? @bug ????? 53 54 54 55 /** 55 56 * Padding above the Newt components, to overcome bugs in Newt. 56 57 */ 57 58 59 60 58 char **err_log_lines = NULL, ///< The list of log lines to show on the screen. 59 *g_blurb_str_1, ///< The string for line 1 of the blurb in the progress form 60 *g_blurb_str_2, ///< The string for line 2 of the blurb in the progress form 61 *g_blurb_str_3; ///< The string for line 3 (updated continuously) of the blurb in the progress form 61 62 newtComponent g_isoform_main = NULL, ///< The evalcall form component itself 62 63 64 65 66 67 68 69 70 71 72 73 74 63 g_isoform_header = NULL, ///< The component for the evalcall form title 64 g_isoform_scale = NULL, ///< The progress bar component in the evalcall form 65 g_isoform_timeline = NULL, ///< The line of the evalcall form that shows the time elapsed/remaining 66 g_isoform_pcline = NULL; ///< The line of the evalcall form that shows the percent completed/remaining 67 long g_isoform_starttime; ///< The time (in seconds since the epoch) that the evalcall form was opened. 68 int g_isoform_old_progress = -1; ///< The most recent progress update of the evalcall form (percent). 69 char *g_isoform_header_str; ///< The string for the evalcall form title. 70 int g_mysterious_dot_counter; ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3 71 int g_noof_log_lines = 6; ///< The number of lines to show in the log at the bottom of the screen. 72 int g_noof_rows = 25; ///< The number of rows on the screen. 73 74 int g_currentY = 3; ///< The row to write background progress messages to. Incremented each time a message is written. 75 extern int g_current_media_number; 75 76 pid_t g_main_pid = 0; ///< The PID of the main Mondo process. 76 77 78 79 80 81 82 char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.77 long g_maximum_progress = 999; ///< The maximum amount of progress (100%) for the currently opened progress form. 78 long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form. 79 long g_start_time = 0; ///< The time (in seconds since the epoch) that the progress form was opened. 80 bool g_text_mode = TRUE; ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface. 81 bool g_called_by_xmondo = FALSE; ///< @bug Unneeded w/current XMondo. 82 char *g_erase_tmpdir_and_scratchdir; ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo. 83 char *g_selfmounted_isodir = NULL; ///< Holds the NFS mountpoint if mounted via mondoarchive. 83 84 84 85 /* @} - end of globalGroup */ … … 86 87 //int g_fd_in=-1, g_fd_out=-1; 87 88 88 89 void popup_and_OK(char *); 89 90 90 91 … … 280 281 kill_anything_like_this("ntfsclone"); 281 282 sync(); 282 asprintf(&tmp, "umount %s", g_tmpfs_mountpt); 283 chdir("/"); 284 for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) { 285 log_msg(2, "Waiting for child processes to terminate"); 286 sleep(1); 287 run_program_and_log_output(tmp, 5); 288 } 289 paranoid_free(tmp); 283 if (g_tmpfs_mountpt != NULL) { 284 asprintf(&tmp, "umount %s", g_tmpfs_mountpt); 285 chdir("/"); 286 for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) { 287 log_msg(2, "Waiting for child processes to terminate"); 288 sleep(1); 289 run_program_and_log_output(tmp, 5); 290 } 291 paranoid_free(tmp); 292 } 290 293 291 294 if (g_erase_tmpdir_and_scratchdir) { … … 298 301 asprintf(&command, "rmdir %s", g_selfmounted_isodir); 299 302 run_program_and_log_output(command, 5); 303 paranoid_free(g_selfmounted_isodir); 300 304 } 301 305 … … 356 360 asprintf(&command, "rmdir %s", g_selfmounted_isodir); 357 361 run_program_and_log_output(command, 1); 362 paranoid_free(g_selfmounted_isodir); 358 363 } 359 364 // iamhere("foo"); … … 469 474 470 475 if (err_log_lines) { 471 paranoid_free( &err_log_lines[0]);476 paranoid_free(err_log_lines[0]); 472 477 for (i = 1; i < g_noof_log_lines; i++) { 473 478 err_log_lines[i - 1] = err_log_lines[i]; … … 676 681 677 682 /*@ pointers ********************************************************* */ 678 char * entry_value = NULL;683 char **entry_value = NULL; 679 684 680 685 /*@ buffers ********************************************************** */ … … 702 707 newtEntry(2, newtTextboxGetNumLines(text) + 2, 703 708 output, 50, 704 &entry_value, NEWT_FLAG_RETURNEXIT709 entry_value, NEWT_FLAG_RETURNEXIT 705 710 ); 706 711 b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, _(" OK ")); … … 721 726 // Copy entry_value before destroying the form 722 727 // clearing potentially output before 723 paranoid_alloc(output, entry_value);728 paranoid_alloc(output,*entry_value); 724 729 } 725 730 newtFormDestroy(myForm);
Note:
See TracChangeset
for help on using the changeset viewer.