Changeset 2322 in MondoRescue
- Timestamp:
- Aug 18, 2009, 2:37:58 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2321 r2322 1226 1226 1227 1227 if (flag_set['p']) { 1228 strncpy(bkpinfo->prefix, flag_val['p'], MAX_STR_LEN / 4); 1228 mr_free(bkpinfo->prefix); 1229 mr_asprintf(&tmp1, "%s", flag_val['p']); 1230 bkpinfo->prefix = tmp1; 1229 1231 log_msg(1,"Prefix forced to %s",bkpinfo->prefix); 1230 1232 } -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2321 r2322 19 19 #include "libmondo-fork-EXT.h" 20 20 #include "libmondo-stream-EXT.h" 21 22 extern void mr_strip_spaces(char *); 21 23 22 24 #include <sys/types.h> … … 1803 1805 finish(1); 1804 1806 } 1807 mr_free(bkpinfo->prefix); 1808 bkpinfo->prefix = p; 1805 1809 log_msg(3, "prefix set to %s", bkpinfo->prefix); 1806 strcpy(bkpinfo->prefix, p);1807 mr_free(p);1808 1810 1809 1811 log_msg(3, "Just set nfs_remote_dir to %s", bkpinfo->nfs_remote_dir); … … 1847 1849 finish(1); 1848 1850 } 1849 strcpy(bkpinfo->prefix, p);1850 mr_free(p);1851 mr_free(bkpinfo->prefix); 1852 bkpinfo->prefix = p; 1851 1853 log_msg(3, "prefix set to %s", bkpinfo->prefix); 1852 1854 break; 1855 1853 1856 default: 1854 1857 fatal_error … … 2017 2020 log_it("media device = %s", bkpinfo->media_device); 2018 2021 log_it("media size = %ld", bkpinfo->media_size[1]); 2019 log_it("media type = %s", 2020 bkptype_to_string(bkpinfo->backup_media_type)); 2022 log_it("media type = %s", bkptype_to_string(bkpinfo->backup_media_type)); 2021 2023 log_it("prefix = %s", bkpinfo->prefix); 2022 2024 log_it("compression = %ld", bkpinfo->compression_level); … … 2026 2028 log_it("tmpdir = '%s'", bkpinfo->tmpdir); 2027 2029 log_it("image_devs = '%s'", bkpinfo->image_devs); 2028 log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device, 2029 bkpinfo->boot_loader); 2030 log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device, bkpinfo->boot_loader); 2030 2031 if (bkpinfo->media_size[0] < 0) { 2031 2032 if (archiving_to_media) { -
branches/2.2.10/mondo/src/common/libmondo-string.c
r2321 r2322 203 203 int i; 204 204 char *tmp; 205 char *tmp1 = NULL; 205 206 char ch; 206 207 … … 224 225 tmp[i] = '\0'; 225 226 outval = atol(tmp); 227 paranoid_free(tmp); 226 228 if (ch == 'g' || ch == 'G') { 227 229 outval = outval * 1024; … … 239 241 fatal_error("Integer overflow."); 240 242 } else if (ch != 'm' && ch != 'M') { 241 sprintf(tmp, "Re: parameter '%s' - bad multiplier ('%c')", 242 incoming, ch); 243 fatal_error(tmp); 244 } 245 paranoid_free(tmp); 243 mr_asprintf(&tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch); 244 fatal_error(tmp1); 245 } 246 246 return (outval); 247 247 } … … 549 549 /*@ buffers **************************************************** */ 550 550 static char output[MAX_STR_LEN]; 551 static char suffix[MAX_STR_LEN];551 char *suffix = NULL; 552 552 553 553 /*@ end vars *************************************************** */ … … 555 555 assert_string_is_neither_NULL_nor_zerolength(path); 556 556 if (s[0] != '\0') { 557 sprintf(suffix, ".%s", s);557 mr_asprintf(&suffix, ".%s", s); 558 558 } else { 559 suffix[0] = '\0';560 } 561 sprintf(output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno, sliceno, 562 559 mr_asprintf(&suffix, ""); 560 } 561 sprintf(output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno, sliceno, suffix); 562 mr_free(suffix); 563 563 return (output); 564 564 } … … 925 925 { 926 926 int sev; 927 char *reason; 928 char *filename; 929 930 malloc_string(reason); 931 malloc_string(filename); 932 927 char *reason = NULL; 928 char *filename = NULL; 929 933 930 // out_reason might be null on purpose, so don't bomb if it is :) OK? 934 931 assert_string_is_neither_NULL_nor_zerolength(fn); 935 932 if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) { 936 strcpy(filename, fn + strlen(MNT_RESTORING));933 mr_asprintf(&filename, "%s", fn + strlen(MNT_RESTORING)); 937 934 } else if (fn[0] != '/') { 938 sprintf(filename, "/%s", fn);935 mr_asprintf(&filename, "/%s", fn); 939 936 } else { 940 strcpy(filename, fn);937 mr_asprintf(&filename, "%s", fn); 941 938 } 942 939 943 940 sev = 3; 944 sprintf(reason,945 "Changed since backup. Consider running a differential backup in a day or two."); 941 mr_asprintf(&reason, "Changed since backup. Consider running a differential backup in a day or two."); 942 946 943 if (!strncmp(filename, "/var/", 5)) { 947 944 sev = 2; 948 sprintf(reason,949 945 mr_free(reason); 946 mr_asprintf(&reason, "/var's contents will change regularly, inevitably."); 950 947 } 951 948 if (!strncmp(filename, "/home", 5)) { 952 949 sev = 2; 953 sprintf(reason,954 950 mr_free(reason); 951 mr_asprintf(&reason, "It's in your /home directory. Therefore, it is important."); 955 952 } 956 953 if (!strncmp(filename, "/usr/", 5)) { 957 954 sev = 3; 958 sprintf(reason,959 955 mr_free(reason); 956 mr_asprintf(&reason, "You may have installed/removed software during the backup."); 960 957 } 961 958 if (!strncmp(filename, "/etc/", 5)) { 962 959 sev = 3; 963 sprintf(reason,964 960 mr_free(reason); 961 mr_asprintf(&reason, "Do not edit config files while backing up your PC."); 965 962 } 966 963 if (!strcmp(filename, "/etc/adjtime") 967 964 || !strcmp(filename, "/etc/mtab")) { 968 965 sev = 1; 969 sprintf(reason, "This file changes all the time. It's OK."); 966 mr_free(reason); 967 mr_asprintf(&reason, "This file changes all the time. It's OK."); 970 968 } 971 969 if (!strncmp(filename, "/root/", 6)) { 972 970 sev = 3; 973 sprintf(reason, "Were you compiling/editing something in /root?"); 971 mr_free(reason); 972 mr_asprintf(&reason, "Were you compiling/editing something in /root?"); 974 973 } 975 974 if (!strncmp(filename, "/root/.", 7)) { 976 975 sev = 2; 977 sprintf(reason, "Temp or 'dot' files changed in /root."); 976 mr_free(reason); 977 mr_asprintf(&reason, "Temp or 'dot' files changed in /root."); 978 978 } 979 979 if (!strncmp(filename, "/var/lib/", 9)) { 980 980 sev = 2; 981 sprintf(reason, "Did you add/remove software during backing?"); 981 mr_free(reason); 982 mr_asprintf(&reason, "Did you add/remove software during backing?"); 982 983 } 983 984 if (!strncmp(filename, "/var/lib/rpm", 12)) { 984 985 sev = 3; 985 sprintf(reason, "Did you add/remove software during backing?"); 986 mr_free(reason); 987 mr_asprintf(&reason, "Did you add/remove software during backing?"); 986 988 } 987 989 if (!strncmp(filename, "/var/lib/slocate", 16)) { 988 990 sev = 1; 989 sprintf(reason,990 991 mr_free(reason); 992 mr_asprintf(&reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup."); 991 993 } 992 994 if (!strncmp(filename, "/var/log/", 9) … … 994 996 || !strcmp(filename + strlen(filename) - 4, ".log")) { 995 997 sev = 1; 996 sprintf(reason,997 998 mr_free(reason); 999 mr_asprintf(&reason, "Log files change frequently as the computer runs. Fret not."); 998 1000 } 999 1001 if (!strncmp(filename, "/var/spool", 10)) { 1000 1002 sev = 1; 1001 sprintf(reason,1002 1003 mr_free(reason); 1004 mr_asprintf(&reason, "Background processes or printers were active. This does not affect the integrity of your backup."); 1003 1005 } 1004 1006 if (!strncmp(filename, "/var/spool/mail", 10)) { 1005 1007 sev = 2; 1006 sprintf(reason, "Mail was sent/received during backup."); 1008 mr_free(reason); 1009 mr_asprintf(&reason, "Mail was sent/received during backup."); 1007 1010 } 1008 1011 if (filename[strlen(filename) - 1] == '~') { 1009 1012 sev = 1; 1010 sprintf(reason,1011 1013 mr_free(reason); 1014 mr_asprintf(&reason, "Backup copy of another file which was modified recently."); 1012 1015 } 1013 1016 if (strstr(filename, "cache")) { 1014 1017 sev = 1; 1015 sprintf(reason,1016 1018 mr_free(reason); 1019 mr_asprintf(&reason, "Part of a cache of data. Caches change from time to time. Don't worry."); 1017 1020 } 1018 1021 if (!strncmp(filename, "/var/run/", 9) … … 1021 1024 || strstr(filename, "/.Xauthority")) { 1022 1025 sev = 1; 1023 sprintf(reason,1024 1026 mr_free(reason); 1027 mr_asprintf(&reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence."); 1025 1028 } 1026 1029 if (out_reason) { 1027 1030 strcpy(out_reason, reason); 1028 1031 } 1029 paranoid_free(filename);1030 paranoid_free(reason);1032 mr_free(filename); 1033 mr_free(reason); 1031 1034 return (sev); 1032 1035 } … … 1078 1081 /*@ buffers ******************************************* */ 1079 1082 char *outstr = NULL; 1080 char *pos_w_commas , *tmp;1083 char *pos_w_commas = NULL; 1081 1084 char *mds = NULL; 1085 char *tmp = NULL; 1082 1086 1083 1087 assert(bkpinfo != NULL); 1084 1088 1085 1089 if (bkpinfo->media_size[g_current_media_number] <= 0) { 1086 malloc_string(pos_w_commas); 1087 malloc_string(tmp); 1088 sprintf(tmp, "%lld", g_tape_posK); 1089 strcpy(pos_w_commas, commarize(tmp)); 1090 paranoid_free(tmp); 1090 mr_asprintf(&tmp, "%lld", g_tape_posK); 1091 mr_asprintf(&pos_w_commas, "%s", commarize(tmp)); 1092 mr_free(tmp); 1091 1093 mr_asprintf(&outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas); 1092 paranoid_free(pos_w_commas);1094 mr_free(pos_w_commas); 1093 1095 return (outstr); 1094 1096 } -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2321 r2322 804 804 { 805 805 int i; 806 char *p = NULL; 806 807 807 808 log_msg(1, "Hi"); … … 832 833 strcpy(bkpinfo->isodir, MONDO_CACHE); 833 834 } 834 strcpy(bkpinfo->prefix, STD_PREFIX); 835 mr_asprintf(&p, "%s", STD_PREFIX); 836 bkpinfo->prefix = p; 835 837 bkpinfo->scratchdir = NULL; 836 838 bkpinfo->tmpdir = NULL; -
branches/2.2.10/mondo/src/common/mondostructures.h
r2321 r2322 472 472 * If backup_media_type is anything else, this is ignored. 473 473 */ 474 char prefix[MAX_STR_LEN / 4];474 char *prefix; 475 475 476 476 /** -
branches/2.2.10/mondo/src/lib/mr_mem.c
r2320 r2322 57 57 58 58 ssize_t ret; 59 s size_t n = 0;59 size_t n = 0; 60 60 61 61 ret = getline(lineptr,&n,fd); -
branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c
r2321 r2322 32 32 33 33 /***************** global vars, used only by main.c ******************/ 34 long diffs ;34 long diffs = 0L; 35 35 36 36 extern t_bkptype g_backup_media_type; … … 167 167 char *tmp = NULL; 168 168 char *tmp1 = NULL; 169 int res, retval; 169 int res = 0; 170 int i = 0; 171 int retval = 0; 170 172 char *say_at_end = NULL; 171 172 /* Initialize variables */173 174 res = 0;175 retval = 0;176 diffs = 0;177 173 178 174 printf("Initializing...\n"); … … 191 187 } else { 192 188 g_text_mode = TRUE; 189 /* newt mode if -g specified on cli */ 190 for (i = 0; i < argc; i++) { 191 if (!strcmp(argv[i],"-g")) { 192 g_text_mode = FALSE; 193 } 194 } 193 195 } 194 196 setup_newt_stuff(); … … 235 237 if (argc == 4 && !strcmp(argv[1], "getfattr")) { 236 238 g_loglevel = 10; 237 g_text_mode = TRUE;238 239 if (!strstr(argv[2], "filelist")) { 239 240 printf("Sorry - filelist goes first\n"); … … 438 439 439 440 if (!g_text_mode) { 440 popup_and_OK 441 ("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt."); 441 popup_and_OK("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt."); 442 442 log_to_screen("See %s for details of backup run.", MONDO_LOGFILE); 443 443 } else { -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2321 r2322 772 772 } 773 773 } 774 mr_free(bkpinfo->prefix); 774 775 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 775 strcpy(bkpinfo->prefix,value);776 mr_asprintf(&tmp1, "%s", value); 776 777 } else { 777 strcpy(bkpinfo->prefix,STD_PREFIX); 778 } 778 mr_asprintf(&tmp1, "%s", STD_PREFIX); 779 } 780 bkpinfo->prefix = tmp1; 779 781 } else if (!strcmp(value, "nfs")) { 780 782 bkpinfo->backup_media_type = nfs; 781 783 bkpinfo->please_dont_eject = TRUE; 784 mr_free(bkpinfo->prefix); 782 785 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 783 strcpy(bkpinfo->prefix,value);786 mr_asprintf(&tmp1, "%s", value); 784 787 } else { 785 strcpy(bkpinfo->prefix,STD_PREFIX); 786 } 787 if (strstr(call_program_and_get_last_line_of_output 788 ("cat /proc/cmdline"), "pxe")) { 788 mr_asprintf(&tmp1, "%s", STD_PREFIX); 789 } 790 bkpinfo->prefix = tmp1; 791 792 if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) { 789 793 /* We need to override prefix value in PXE mode as it's 790 794 * already done in start-nfs */ … … 793 797 fatal_error("no imgname variable in environment"); 794 798 } 795 strcpy(bkpinfo->prefix,envtmp1); 799 mr_free(bkpinfo->prefix); 800 mr_asprintf(&tmp1, "%s", envtmp1); 801 bkpinfo->prefix = tmp1; 796 802 } 797 803
Note:
See TracChangeset
for help on using the changeset viewer.