Changeset 3161 in MondoRescue
- Timestamp:
- Jun 25, 2013, 10:53:14 PM (12 years ago)
- Location:
- branches/3.1/mondo
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/common/libmondo-archive.c
r3148 r3161 686 686 fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?"); 687 687 } 688 mr_asprintf( &bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version"));688 mr_asprintf(bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version", TRUE)); 689 689 } else if (bkpinfo->boot_loader == 'E') { 690 690 mr_asprintf(bootldr_str, "ELILO"); … … 722 722 log_to_screen("Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 723 723 if (bootldr_ver != NULL) { 724 mr_asprintf( &tmp, "Boot loader version string: %s", bootldr_ver);724 mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver); 725 725 log_to_screen(tmp); 726 726 mr_free(tmp); 727 727 } 728 728 if (bootldr_ver != NULL) { 729 mr_asprintf( &tmp, "Boot loader version string: %s", bootldr_ver);729 mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver); 730 730 log_to_screen(tmp); 731 731 mr_free(tmp); … … 1590 1590 /*@ buffers ****************************************** */ 1591 1591 char *tmp = NULL; 1592 char *tmp2 = NULL; 1592 1593 char *old_pwd; 1593 1594 char *result_sz = NULL; … … 1614 1615 log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile); 1615 1616 tmp2 = getcwd(old_pwd, MAX_STR_LEN - 1); 1617 if (! tmp2) { 1618 //FIXME 1619 } 1616 1620 mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1617 1621 run_program_and_log_output(tmp, FALSE); … … 1733 1737 mr_free(mds); 1734 1738 if (find_home_of_exe("genisoimage")) { 1735 mr_asprintf( &isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);1739 mr_asprintf(isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD); 1736 1740 } else { 1737 mr_asprintf( &isofs_cmd, "%s", MONDO_MKISOFS_CMD);1741 mr_asprintf(isofs_cmd, "%s", MONDO_MKISOFS_CMD); 1738 1742 } 1739 1743 if (bkpinfo->nonbootable_backup) { 1740 1744 log_msg(1, "Making nonbootable backup"); 1741 1745 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS); 1742 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1746 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen); 1743 1747 mr_free(full_isofs_cmd); 1744 1748 } else { … … 1756 1760 log_msg(1, "IA64 --> elilo"); 1757 1761 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO); 1758 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1762 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen); 1759 1763 mr_free(full_isofs_cmd); 1760 1764 #else … … 1762 1766 mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS); 1763 1767 // FIXME: fixed boot size probably wrong. lilo to be removed 1764 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1768 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen); 1765 1769 #endif 1766 1770 } else { … … 1768 1772 log_msg(1, "Isolinux"); 1769 1773 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX); 1770 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE,message_to_screen);1774 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen); 1771 1775 } 1772 1776 mr_free(full_isofs_cmd); … … 1884 1888 /*@ pointers ******************************************* */ 1885 1889 FILE *fin = NULL; 1886 char *q;1887 char *q;1888 1890 1889 1891 /*@ buffers ******************************************** */ -
branches/3.1/mondo/src/common/libmondo-cli.c
r3148 r3161 507 507 mr_asprintf(tmp1, "sshfs %s@%s", bkpinfo->netfs_user, bkpinfo->netfs_mount); 508 508 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) { 509 sprintf(tmp, "mount -t cifs %s -o user=%s", bkpinfo->netfs_mount, bkpinfo->netfs_user);509 mr_asprintf(tmp1, "mount -t cifs %s -o user=%s", bkpinfo->netfs_mount, bkpinfo->netfs_user); 510 510 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) { 511 sprintf(tmp, "mount -t cifs %s -o user=%s", bkpinfo->netfs_mount, bkpinfo->netfs_user);511 mr_asprintf(tmp1, "mount -t cifs %s -o user=%s", bkpinfo->netfs_mount, bkpinfo->netfs_user); 512 512 } else if (strstr(bkpinfo->netfs_proto, "nfs")) { 513 513 mr_asprintf(tmp1, "mount %s@%s", bkpinfo->netfs_user, bkpinfo->netfs_mount); … … 520 520 mr_asprintf(tmp1, "sshfs %s", bkpinfo->netfs_mount); 521 521 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) { 522 sprintf(tmp, "mount -t cifs %s", bkpinfo->netfs_mount);522 mr_asprintf(tmp1, "mount -t cifs %s", bkpinfo->netfs_mount); 523 523 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) { 524 sprintf(tmp, "mount -t cifs %s", bkpinfo->netfs_mount);524 mr_asprintf(tmp1, "mount -t cifs %s", bkpinfo->netfs_mount); 525 525 } else if (strstr(bkpinfo->netfs_proto, "nfs")) { 526 526 mr_asprintf(tmp1, "mount %s", bkpinfo->netfs_mount); -
branches/3.1/mondo/src/common/libmondo-devices.c
r3148 r3161 330 330 char *incoming = NULL; 331 331 char *searchstr = NULL; 332 char *tmp = NULL;333 char *p;334 char *p;335 332 336 333 /*@ ints ******************************************************* */ … … 339 336 /*@ pointers *************************************************** */ 340 337 FILE *fin; 341 342 338 343 339 /*@ end vars *************************************************** */ … … 354 350 mr_free(program); 355 351 return (res); 356 #else357 /* To avoid compiler warnings */358 tmp = NULL;359 352 #endif 360 353 … … 984 977 char *command = NULL; 985 978 char *format_sz = NULL; 986 char *p;987 char *p;988 979 989 980 FILE *pin; … … 2032 2023 mr_strcat(bkpinfo->exclude_paths,"|%s",mounted_on_dsf); 2033 2024 } else { 2034 mr_asprintf( &(bkpinfo->exclude_paths),"%s",mounted_on_dsf);2025 mr_asprintf(bkpinfo->exclude_paths,"%s",mounted_on_dsf); 2035 2026 } 2036 2027 if (bkpinfo->exclude_devs) { 2037 2028 mr_strcat(bkpinfo->exclude_devs,"|%s",token); 2038 2029 } else { 2039 mr_asprintf( &(bkpinfo->exclude_devs),"%s",token);2030 mr_asprintf(bkpinfo->exclude_devs,"%s",token); 2040 2031 } 2041 2032 } … … 2052 2043 mr_strcat(bkpinfo->exclude_paths, "|%s",not_mounted_on_dsf); 2053 2044 } else { 2054 mr_asprintf( &(bkpinfo->exclude_paths),"%s",not_mounted_on_dsf);2045 mr_asprintf(bkpinfo->exclude_paths,"%s",not_mounted_on_dsf); 2055 2046 } 2056 2047 } … … 2065 2056 /* Adds a | to ensure correct detection even at both ends */ 2066 2057 mr_asprintf(tmp1,"|%s",token); 2067 mr_asprintf( &tmp2,"|%s|",token);2058 mr_asprintf(tmp2,"|%s|",token); 2068 2059 if (mode == 'E') { 2069 2060 /* Add the token if not already in the list */ … … 2984 2975 2985 2976 } 2986 <<<<<<< .courant2987 2977 p = popup_and_get_string("Network protocol", "Which Network protocol should I use (nfs/sshfs/smbfs) ?", bkpinfo->netfs_proto); 2988 2978 if (p == NULL) { … … 3006 2996 strcpy(tmp1, ""); 3007 2997 } 3008 if (!popup_and_get_string 3009 ("Network user", "Which user should I use if any ?", 3010 tmp1, MAX_STR_LEN)) { 2998 if (!popup_and_get_string("Network user", "Which user should I use if any ?",tmp1)) { 3011 2999 log_to_screen("User has chosen not to backup the PC"); 3012 3000 finish(1); … … 3014 3002 mr_free(bkpinfo->netfs_user); 3015 3003 if (strcmp(tmp1, "") != 0) { 3016 mr_asprintf( &(bkpinfo->netfs_user), "%s", tmp1);3004 mr_asprintf(bkpinfo->netfs_user, "%s", tmp1); 3017 3005 } 3018 3006 -
branches/3.1/mondo/src/common/libmondo-filelist.c
r3148 r3161 399 399 char *tmp = NULL; 400 400 401 char *p;402 403 char *p;404 405 401 pattr = popen(syscall, "r"); 406 402 if (!pattr) { … … 434 430 char *strtmp = NULL; 435 431 char *tmp = NULL; 436 char *p = NULL;437 432 int i; 438 433 … … 521 516 int retval = 0; 522 517 int i; 523 char *p, *q , *r;518 char *p, *q; 524 519 char *tmp = NULL; 525 520 FILE *pin, *pout, *faclin; … … 1404 1399 1405 1400 mr_asprintf(find_skeleton_marker, "mv -f %s.new %s", g_skeleton_filelist, g_skeleton_filelist); 1406 (void)system(find_skeleton_marker); 1401 if (system(find_skeleton_marker)) { 1402 //FIXME 1403 } 1407 1404 time(&this_time); 1408 1405 if (this_time != last_time) { -
branches/3.1/mondo/src/common/libmondo-files.c
r3148 r3161 51 51 /*@ pointers **************************************************** */ 52 52 char *p = NULL; 53 char *q;54 char *q;55 53 FILE *fin; 56 54 … … 128 126 char *command = NULL; 129 127 char *incoming = NULL; 130 char *q;131 char *q;132 128 133 129 /*@ long ******************************************************** */ … … 208 204 char *tmp = NULL; 209 205 char *incoming = NULL; 210 char *q;211 char *q;212 206 213 207 /*@ int ********************************************************* */ … … 477 471 char *output = NULL; 478 472 char *command = NULL; 479 char *p = NULL;480 char *p = NULL;481 473 482 474 /*@ pointers **************************************************** */ … … 548 540 char *curr_cksum = NULL; 549 541 char *tmp = NULL; 550 char *q;551 char *q;552 542 553 543 /*@ long [long] ************************************************* */ … … 689 679 /*@ buffers **************************************************** */ 690 680 char *incoming = NULL; 691 char *p = NULL;692 char *p = NULL;693 681 694 682 /*@ end vars *************************************************** */ … … 755 743 char *tmp = NULL; 756 744 char *command = NULL; 757 char *comment;758 745 759 746 /*@ long ******************************************************** */ -
branches/3.1/mondo/src/common/libmondo-fork.c
r3148 r3161 42 42 char *newcall = NULL; 43 43 char *tmp = NULL; 44 char *p;45 char *p;46 44 47 45 /*@ pointers **************************************************** */ 48 46 FILE *fin = NULL; 47 int res = 0; 49 48 50 49 /*@******************************************************************** */ … … 60 59 mr_asprintf(result, ""); 61 60 62 system(newcall); 61 res = system(newcall); 62 if (res != 0) { 63 //FIXME 64 } 63 65 mr_free(newcall); 64 66 -
branches/3.1/mondo/src/common/libmondo-mountlist.c
r3147 r3161 805 805 char *tmp = NULL; 806 806 char *p = NULL; 807 char *q = NULL;808 807 809 808 int items = 0; -
branches/3.1/mondo/src/common/libmondo-raid.c
r3147 r3161 430 430 char *incoming = NULL; 431 431 char *p; 432 char *q;433 432 434 433 assert(fin != NULL); … … 974 973 char type; 975 974 char *strtmp = NULL; 976 char *strtmp2 = NULL; 977 978 // open file 979 if (!(fin = fopen(MDSTAT_FILE, "r"))) { 980 log_msg(1, "Could not open %s.\n", MDSTAT_FILE); 981 return 1; 982 } 983 // initialise record, build progress and row counters 984 raidlist->entries = 0; 985 raidlist->el[raidlist->entries].progress = 999; 986 row = 1; 987 // skip first output row - contains registered RAID levels 988 res = getline(&string, &len, fin); 989 // parse the rest 990 while ( !feof_unlocked(fin) ) { 991 res = getline(&string, &len, fin); 992 if (res <= 0) break; 993 // trim leading spaces 994 pos = string; 995 while (*pos == ' ') pos += 1; 996 mr_asprintf(strtmp, "%s", pos); 997 strcpy(string, strtmp); 998 mr_free(strtmp); 999 // if we have newline after only spaces, this is a blank line, update 1000 // counters, otherwise do normal parsing 1001 if (*string == '\n') { 1002 row = 1; 1003 raidlist->entries++; 1004 raidlist->el[raidlist->entries].progress = 999; 1005 } else { 1006 switch (row) { 1007 case 1: // device information 1008 // check whether last line of record and if so skip 1009 pos = strcasestr(string, "unused devices: "); 1010 if (pos == string) { 1011 //raidlist->entries--; 1012 break; 1013 } 1014 // tokenise string 1015 token = mr_strtok(string, delims, &lastpos); 1016 // get RAID device name 1017 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1018 strcpy(raidlist->el[raidlist->entries].raid_device, strtmp); 975 976 // open file 977 if (!(fin = fopen(MDSTAT_FILE, "r"))) { 978 log_msg(1, "Could not open %s.\n", MDSTAT_FILE); 979 return 1; 980 } 981 // initialise record, build progress and row counters 982 raidlist->entries = 0; 983 raidlist->el[raidlist->entries].progress = 999; 984 row = 1; 985 // skip first output row - contains registered RAID levels 986 res = getline(&string, &len, fin); 987 // parse the rest 988 while ( !feof_unlocked(fin) ) { 989 res = getline(&string, &len, fin); 990 if (res <= 0) break; 991 // trim leading spaces 992 pos = string; 993 while (*pos == ' ') pos += 1; 994 mr_asprintf(strtmp, "%s", pos); 995 strcpy(string, strtmp); 1019 996 mr_free(strtmp); 1020 mr_free(token); 1021 // skip ':' and status 1022 token = mr_strtok(string, delims, &lastpos); 1023 mr_free(token); 1024 token = mr_strtok(string, delims, &lastpos); 1025 if (!strcmp(token, "inactive")) { 1026 log_msg(1, "RAID device '%s' inactive.\n", 1027 raidlist->el[raidlist->entries].raid_device); 1028 paranoid_free(string); 1029 mr_free(token); 1030 return 1; 1031 } 1032 mr_free(token); 1033 1034 // get RAID level 1035 token = mr_strtok(string, delims, &lastpos); 1036 // skip potential auto-read-only entry 1037 if (!strcmp(token, "(auto-read-only)")) { 1038 mr_free(token); 1039 token = mr_strtok (string, delims, &lastpos); 1040 } 1041 if (!strcmp(token, "multipath")) { 1042 raidlist->el[raidlist->entries].raid_level = -2; 1043 } else if (!strcmp(token, "linear")) { 1044 raidlist->el[raidlist->entries].raid_level = -1; 1045 } else if (!strcmp(token, "raid0")) { 1046 raidlist->el[raidlist->entries].raid_level = 0; 1047 } else if (!strcmp(token, "raid1")) { 1048 raidlist->el[raidlist->entries].raid_level = 1; 1049 } else if (!strcmp(token, "raid4")) { 1050 raidlist->el[raidlist->entries].raid_level = 4; 1051 } else if (!strcmp(token, "raid5")) { 1052 raidlist->el[raidlist->entries].raid_level = 5; 1053 } else if (!strcmp(token, "raid6")) { 1054 raidlist->el[raidlist->entries].raid_level = 6; 1055 } else if (!strcmp(token, "raid10")) { 1056 raidlist->el[raidlist->entries].raid_level = 10; 997 // if we have newline after only spaces, this is a blank line, update 998 // counters, otherwise do normal parsing 999 if (*string == '\n') { 1000 row = 1; 1001 raidlist->entries++; 1002 raidlist->el[raidlist->entries].progress = 999; 1057 1003 } else { 1058 1004 switch (row) { 1059 1005 case 1: // device information 1060 1006 // check whether last line of record and if so skip 1061 log_msg(8, "This is the device line\n");1062 1007 pos = strcasestr(string, "unused devices: "); 1063 if (pos != NULL) { 1008 if (pos == string) { 1009 //raidlist->entries--; 1064 1010 break; 1065 1011 } … … 1071 1017 } 1072 1018 // get RAID device name 1073 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 1074 strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63); 1075 raidlist->el[raidlist->entries].raid_device[63] = '\0'; 1019 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1020 strcpy(raidlist->el[raidlist->entries].raid_device, strtmp); 1076 1021 mr_free(strtmp); 1077 1022 mr_free(token); … … 1079 1024 v = raidlist->el[raidlist->entries].additional_vars.entries; 1080 1025 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "UUID"); 1081 mr_asprintf( &cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);1082 mr_asprintf( &strtmp, "%s", call_program_and_get_last_line_of_output(cmd));1026 mr_asprintf(cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device); 1027 mr_asprintf(strtmp, "%s", call_program_and_get_last_line_of_output(cmd, TRUE)); 1083 1028 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp); 1084 1029 mr_free(strtmp); … … 1086 1031 // store the Version value in the additional_vars structure 1087 1032 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "Version"); 1088 mr_asprintf( &cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);1089 mr_asprintf( &strtmp, "%s", call_program_and_get_last_line_of_output(cmd));1033 mr_asprintf(cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device); 1034 mr_asprintf(strtmp, "%s", call_program_and_get_last_line_of_output(cmd, TRUE)); 1090 1035 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp); 1091 1036 mr_free(strtmp); … … 1093 1038 raidlist->el[raidlist->entries].additional_vars.entries = v; 1094 1039 // skip ':' and status 1095 token = mr_strtok 1040 token = mr_strtok(string, delims, &lastpos); 1096 1041 if (token == NULL) { 1097 1042 // should not happen ! … … 1099 1044 } 1100 1045 mr_free(token); 1101 token = mr_strtok 1046 token = mr_strtok(string, delims, &lastpos); 1102 1047 if (token == NULL) { 1103 1048 // should not happen ! … … 1105 1050 } 1106 1051 if (!strcmp(token, "inactive")) { 1107 log_msg(1, "RAID device '%s' inactive.\n", 1108 raidlist->el[raidlist->entries].raid_device); 1052 log_msg(1, "RAID device '%s' inactive.\n", raidlist->el[raidlist->entries].raid_device); 1109 1053 mr_free(string); 1110 1054 mr_free(token); … … 1113 1057 mr_free(token); 1114 1058 1115 // get RAID devices (type, index, device) 1116 // Note: parity disk for RAID4 is last normal disk, there is no '(P)' 1117 raidlist->el[raidlist->entries].data_disks.entries = 0; 1118 raidlist->el[raidlist->entries].spare_disks.entries = 0; 1119 raidlist->el[raidlist->entries].failed_disks.entries = 0; 1120 while((token = mr_strtok (string, delims, &lastpos))) { 1121 if ((pos = strstr(token, "("))) { 1122 type = *(pos+1); 1123 } else { 1124 type = ' '; 1125 } 1126 pos = strstr(token, "["); 1127 *pos = '\0'; 1128 switch(type) { 1129 case ' ': // normal data disks 1130 raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1); 1131 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1132 strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp); 1133 mr_free(strtmp); 1134 raidlist->el[raidlist->entries].data_disks.entries++; 1135 break; 1136 case 'S': // spare disks 1137 raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1); 1138 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1139 strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp); 1140 mr_free(strtmp); 1141 raidlist->el[raidlist->entries].spare_disks.entries++; 1142 break; 1143 case 'F': // failed disks 1144 raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1); 1145 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1146 strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp); 1147 mr_free(strtmp); 1148 raidlist->el[raidlist->entries].failed_disks.entries++; 1149 log_it("At least one failed disk found in RAID array.\n"); 1150 break; 1151 default: // error 1152 log_msg(1, "Unknown device type '%c'\n", type); 1153 paranoid_free(string); 1154 paranoid_free(token); 1155 return 1; 1156 break; 1157 } 1158 mr_free(token); 1159 } 1160 1161 // get RAID devices (type, index, device) 1162 // Note: parity disk for RAID4 is last normal disk, there is no '(P)' 1163 raidlist->el[raidlist->entries].data_disks.entries = 0; 1164 raidlist->el[raidlist->entries].spare_disks.entries = 0; 1165 raidlist->el[raidlist->entries].failed_disks.entries = 0; 1166 while((token = mr_strtok (string, delims, &lastpos))) { 1167 if ((pos = strstr(token, "("))) { 1168 type = *(pos+1); 1169 } else { 1170 type = ' '; 1171 } 1172 pos = strstr(token, "["); 1173 *pos = '\0'; 1174 switch(type) { 1175 case ' ': // normal data disks 1176 raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1); 1177 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 1178 strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp); 1179 mr_free(strtmp); 1180 raidlist->el[raidlist->entries].data_disks.entries++; 1181 break; 1182 case 'S': // spare disks 1183 raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1); 1184 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 1185 strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp); 1186 mr_free(strtmp); 1187 raidlist->el[raidlist->entries].spare_disks.entries++; 1188 break; 1189 case 'F': // failed disks 1190 raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1); 1191 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 1192 strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp); 1193 mr_free(strtmp); 1194 raidlist->el[raidlist->entries].failed_disks.entries++; 1195 log_it("At least one failed disk found in RAID array.\n"); 1196 break; 1197 default: // error 1198 log_msg(1, "Unknown device type '%c'\n", type); 1199 mr_free(string); 1200 mr_free(token); 1201 return 1; 1202 break; 1203 } 1204 mr_free(token); 1205 } 1206 1207 // adjust index for each device so that it starts with 0 for every type 1208 index_min = 99; 1209 for (i=0; i<raidlist->el[raidlist->entries].data_disks.entries;i++) { 1210 if (raidlist->el[raidlist->entries].data_disks.el[i].index < index_min) { 1211 index_min = raidlist->el[raidlist->entries].data_disks.el[i].index; 1212 } 1213 } 1214 if (index_min > 0) { 1215 for (i=0; i<raidlist->el[raidlist->entries].data_disks.entries;i++) { 1216 raidlist->el[raidlist->entries].data_disks.el[i].index = raidlist->el[raidlist->entries].data_disks.el[i].index - index_min; 1217 } 1218 } 1219 index_min = 99; 1220 for (i=0; i<raidlist->el[raidlist->entries].spare_disks.entries;i++) { 1221 if (raidlist->el[raidlist->entries].spare_disks.el[i].index < index_min) { 1222 index_min = raidlist->el[raidlist->entries].spare_disks.el[i].index; 1223 } 1224 } 1225 if (index_min > 0) { 1226 for (i=0; i<raidlist->el[raidlist->entries].spare_disks.entries;i++) { 1227 raidlist->el[raidlist->entries].spare_disks.el[i].index = raidlist->el[raidlist->entries].spare_disks.el[i].index - index_min; 1228 } 1229 } 1230 index_min = 99; 1231 for (i=0; i<raidlist->el[raidlist->entries].failed_disks.entries;i++) { 1232 if (raidlist->el[raidlist->entries].failed_disks.el[i].index < index_min) { 1233 index_min = raidlist->el[raidlist->entries].failed_disks.el[i].index; 1234 } 1235 } 1236 if (index_min > 0) { 1237 for (i=0; i<raidlist->el[raidlist->entries].failed_disks.entries;i++) { 1238 raidlist->el[raidlist->entries].failed_disks.el[i].index = raidlist->el[raidlist->entries].failed_disks.el[i].index - index_min; 1239 } 1240 } 1241 break; 1242 case 2: // config information 1243 // check for persistent super block 1244 if (strcasestr(string, "super non-persistent")) { 1059 // get RAID level 1060 token = mr_strtok(string, delims, &lastpos); 1061 if (token == NULL) { 1062 // should not happen ! 1063 break; 1064 } 1065 // skip potential auto-read-only entry 1066 if (!strcmp(token, "(auto-read-only)")) { 1067 mr_free(token); 1068 token = mr_strtok (string, delims, &lastpos); 1069 if (token == NULL) { 1070 // should not happen ! 1071 break; 1072 } 1073 } 1074 if (!strcmp(token, "multipath")) { 1075 raidlist->el[raidlist->entries].raid_level = -2; 1076 } else if (!strcmp(token, "linear")) { 1077 raidlist->el[raidlist->entries].raid_level = -1; 1078 } else if (!strcmp(token, "raid0")) { 1079 raidlist->el[raidlist->entries].raid_level = 0; 1080 } else if (!strcmp(token, "raid1")) { 1081 raidlist->el[raidlist->entries].raid_level = 1; 1082 } else if (!strcmp(token, "raid4")) { 1083 raidlist->el[raidlist->entries].raid_level = 4; 1084 } else if (!strcmp(token, "raid5")) { 1085 raidlist->el[raidlist->entries].raid_level = 5; 1086 } else if (!strcmp(token, "raid6")) { 1087 raidlist->el[raidlist->entries].raid_level = 6; 1088 } else if (!strcmp(token, "raid10")) { 1089 raidlist->el[raidlist->entries].raid_level = 10; 1090 } else { 1091 log_msg(1, "Unknown RAID level '%s'.\n", token); 1092 mr_free(string); 1093 mr_free(token); 1094 return 1; 1095 } 1096 mr_free(token); 1097 1098 // get RAID devices (type, index, device) 1099 // Note: parity disk for RAID4 is last normal disk, there is no '(P)' 1100 raidlist->el[raidlist->entries].data_disks.entries = 0; 1101 raidlist->el[raidlist->entries].spare_disks.entries = 0; 1102 raidlist->el[raidlist->entries].failed_disks.entries = 0; 1103 while((token = mr_strtok (string, delims, &lastpos))) { 1104 if ((pos = strstr(token, "("))) { 1105 type = *(pos+1); 1106 } else { 1107 type = ' '; 1108 } 1109 pos = strstr(token, "["); 1110 *pos = '\0'; 1111 switch(type) { 1112 case ' ': // normal data disks 1113 raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1); 1114 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1115 strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp); 1116 mr_free(strtmp); 1117 raidlist->el[raidlist->entries].data_disks.entries++; 1118 break; 1119 case 'S': // spare disks 1120 raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1); 1121 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1122 strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp); 1123 mr_free(strtmp); 1124 raidlist->el[raidlist->entries].spare_disks.entries++; 1125 break; 1126 case 'F': // failed disks 1127 raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1); 1128 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1129 strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp); 1130 mr_free(strtmp); 1131 raidlist->el[raidlist->entries].failed_disks.entries++; 1132 log_it("At least one failed disk found in RAID array.\n"); 1133 break; 1134 default: // error 1135 log_msg(1, "Unknown device type '%c'\n", type); 1136 mr_free(string); 1137 mr_free(token); 1138 return 1; 1139 break; 1140 } 1141 mr_free(token); 1142 } 1143 1144 // adjust index for each device so that it starts with 0 for every type 1145 index_min = 99; 1146 for (i=0; i<raidlist->el[raidlist->entries].data_disks.entries;i++) { 1147 if (raidlist->el[raidlist->entries].data_disks.el[i].index < index_min) { 1148 index_min = raidlist->el[raidlist->entries].data_disks.el[i].index; 1149 } 1150 } 1151 if (index_min > 0) { 1152 for (i=0; i<raidlist->el[raidlist->entries].data_disks.entries;i++) { 1153 raidlist->el[raidlist->entries].data_disks.el[i].index = raidlist->el[raidlist->entries].data_disks.el[i].index - index_min; 1154 } 1155 } 1156 index_min = 99; 1157 for (i=0; i<raidlist->el[raidlist->entries].spare_disks.entries;i++) { 1158 if (raidlist->el[raidlist->entries].spare_disks.el[i].index < index_min) { 1159 index_min = raidlist->el[raidlist->entries].spare_disks.el[i].index; 1160 } 1161 } 1162 if (index_min > 0) { 1163 for (i=0; i<raidlist->el[raidlist->entries].spare_disks.entries;i++) { 1164 raidlist->el[raidlist->entries].spare_disks.el[i].index = raidlist->el[raidlist->entries].spare_disks.el[i].index - index_min; 1165 } 1166 } 1167 index_min = 99; 1168 for (i=0; i<raidlist->el[raidlist->entries].failed_disks.entries;i++) { 1169 if (raidlist->el[raidlist->entries].failed_disks.el[i].index < index_min) { 1170 index_min = raidlist->el[raidlist->entries].failed_disks.el[i].index; 1171 } 1172 } 1173 if (index_min > 0) { 1174 for (i=0; i<raidlist->el[raidlist->entries].failed_disks.entries;i++) { 1175 raidlist->el[raidlist->entries].failed_disks.el[i].index = raidlist->el[raidlist->entries].failed_disks.el[i].index - index_min; 1176 } 1177 } 1178 break; 1179 case 2: // config information 1180 // check for persistent super block 1181 if (strcasestr(string, "super non-persistent")) { 1245 1182 raidlist->el[raidlist->entries].persistent_superblock = 0; 1246 1183 } else { … … 1252 1189 } else { 1253 1190 while (*pos != ' ') { 1254 1255 1256 1257 1258 1259 1191 pos -= 1; 1192 if (pos < string) { 1193 log_it("String underflow!\n"); 1194 mr_free(string); 1195 return 1; 1196 } 1260 1197 } 1261 1198 raidlist->el[raidlist->entries].chunk_size = atoi(pos + 1); … … 1271 1208 if (!(pos = strchr(string, '\%'))) { 1272 1209 if (strcasestr(string, "delayed")) { 1273 1210 raidlist->el[raidlist->entries].progress = -1; // delayed (therefore, stuck at 0%) 1274 1211 } else { 1275 1212 raidlist->el[raidlist->entries].progress = 999; // not found 1276 1213 } 1277 1214 } else { 1278 1215 while (*pos != ' ') { 1279 1280 1281 1282 1283 1284 1216 pos -= 1; 1217 if (pos < string) { 1218 printf("ERROR: String underflow!\n"); 1219 mr_free(string); 1220 return 1; 1221 } 1285 1222 } 1286 1223 raidlist->el[raidlist->entries].progress = atoi(pos); 1287 1224 } 1288 1225 break; 1289 1226 default: // error or IN PROGRESS 1290 1227 if (raidlist->el[raidlist->entries].progress != -1 && 1291 1228 raidlist->el[raidlist->entries].progress != 999) { … … 1293 1230 } 1294 1231 break; 1295 1296 1297 } 1298 1299 1232 } 1233 row++; 1234 } 1235 // free string 1236 mr_free(string); 1300 1237 } 1301 1238 // close file -
branches/3.1/mondo/src/common/libmondo-stream.c
r3147 r3161 535 535 536 536 bufsize_K = (long long) (1024LL * (1 + g_tape_buffer_size_MB)); 537 if (strstr(latest_fname, ".afio.") || strstr(latest_fname, ".star.")) {538 type = fileset;539 } else if (strstr(latest_fname, "slice")) {540 type = biggieslice;541 } else {542 log_it("fname = %s", latest_fname);543 fatal_error("Unknown type. Internal error in maintain_collection_of_recent_archives()");544 }545 537 mr_asprintf(tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir); 546 538 mkdir(tmpdir, 0x700); … … 744 736 745 737 /* restore compression mode on */ 746 mr_asprintf( &command, "mt -f %s compression on",bkpinfo->media_device);738 mr_asprintf(command, "mt -f %s compression on",bkpinfo->media_device); 747 739 res = run_program_and_log_output(command, 1); 748 740 paranoid_free(command); … … 1313 1305 char *pA; 1314 1306 char *pB; 1307 int ctrl_chr; 1315 1308 int res; 1316 int ctrl_chr;1317 1309 char *temp_fname; 1318 1310 char *datablock; … … 1342 1334 while (ctrl_chr != BLK_START_FILE) { 1343 1335 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1336 if (res) { 1337 //FIXME 1338 } 1344 1339 if (ctrl_chr == BLK_START_FILE) { 1345 1340 break; -
branches/3.1/mondo/src/common/libmondo-tools.c
r3147 r3161 643 643 colon++; 644 644 hent = gethostbyname(colon); 645 mr_asprintf( &(bkpinfo->netfs_user),"%s", hostname);645 mr_asprintf(bkpinfo->netfs_user,"%s", hostname); 646 646 } else { 647 647 hent = gethostbyname(hostname); -
branches/3.1/mondo/src/common/libmondo-verify.c
r3147 r3161 305 305 log_to_screen("%s/%s not found on live filesystem", bkpinfo->restore_path, biggiestruct.filename); 306 306 mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir); 307 system(tmp); 307 if (system(tmp)) { 308 //FIXME 309 } 308 310 mr_free(tmp); 309 311 … … 412 414 char *outlog = NULL; 413 415 char *tmp = NULL; 414 char *p = NULL;415 416 416 417 /*@ pointers ******************************************************* */ -
branches/3.1/mondo/src/common/newt-specific.c
r3148 r3161 171 171 /*@ buffer *********************************************************** */ 172 172 char *tmp = NULL; 173 char *p;174 char *p;175 173 int i; 176 174 … … 442 440 char *command = NULL; 443 441 char *tmp = NULL; 444 char *p = NULL;445 442 446 443 /*@ pointers ********************************************************* */ … … 468 465 for (err_log_lines[i][0] = '\0'; 469 466 strlen(err_log_lines[i]) < 2 && !feof(fin);) { 470 (void) fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, fin); 467 if (fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, fin)) { 468 //FIXME 469 } 471 470 /* Commented to make valgrind happy and avoid crash 472 471 strip_spaces(err_log_lines[i]); … … 782 781 /*@ buffers *********************************************************** */ 783 782 char *prompt = NULL; 784 char *q;785 char *q;786 783 787 784 /*@ newt ************************************************************** */ … … 1151 1148 static char *possible_responses[] = { "none", "cdr", "cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL }; 1152 1149 char *outstr = NULL; 1153 char *p;1154 char *p;1155 1150 t_bkptype backup_type; 1156 1151 int i; … … 1350 1345 bool done; 1351 1346 char *tmp = NULL; 1352 char *p;1353 char *p;1354 1347 char *tmp1 = NULL; 1355 1348 FILE *fin, *fout; -
branches/3.1/mondo/src/mondorestore/mondo-prep.c
r3148 r3161 188 188 char *p; 189 189 char *q; 190 char *r;191 190 192 191 /** int ***************************************************/ … … 391 390 } 392 391 mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command); 393 system(tmp1); 392 if (system(tmp1)) { 393 //FIXME 394 } 394 395 mr_free(tmp1); 395 396 sleep(1); … … 443 444 /** pointers *********************************************************/ 444 445 char *p; 445 char *q;446 446 447 447 /** init *************************************************************/ … … 533 533 int i = 0; 534 534 int j = 0; 535 int v = 0;536 535 int res = 0; 537 536 … … 540 539 char *level = NULL; 541 540 char *program = NULL; 542 543 malloc_string(bootdevice); 544 malloc_string(name); 545 541 char *strtmp = NULL; 542 char *oldmd = NULL; 543 546 544 // leave straight away if raidlist is initial or has no entries 547 545 if (!raidlist || raidlist->entries == 0) { … … 587 585 // - faulty devices ignored 588 586 // - persistent superblock always used as this is recommended 589 // As per bug #473, the parameter "-e 0.90" is used only when:590 // 1) It detects that system boots from Raid-1591 // 2) grub bootloader < v1 is used.592 // Otherwise it won't boot which is bad.593 read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice);594 read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);595 if (strcmp(name,"GRUB") == 0) {596 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("grub --version"));597 if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {598 mr_free(oldmd);599 mr_asprintf(oldmd, "-e 0.90");600 log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device);601 }602 } else if ((strcmp(name,"LILO") == 0) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {603 mr_free(oldmd);604 mr_asprintf(oldmd, "-e 0.90");605 log_it("Forcing old metadata 0.90 for md on %s for LILO", device);606 } else {607 mr_asprintf(oldmd, "");608 }609 mr_free(device);610 mr_free(name);611 587 612 588 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd); … … 632 608 break; 633 609 } 634 paranoid_free(strtmp);610 mr_free(strtmp); 635 611 } 636 612 if (raidlist->el[i].chunk_size != -1) { … … 1039 1015 sync(); 1040 1016 sync(); 1041 system("reboot"); 1017 if (system("reboot")) { 1018 // FIXME 1019 } 1042 1020 } 1043 1021 } else { … … 1420 1398 char *tmp = NULL; 1421 1399 char *tmp1 = NULL; 1422 char *tmp1 = NULL;1423 char *tmp1 = NULL;1424 1400 1425 1401 /** end *************************************************************/ … … 1594 1570 sync(); 1595 1571 paranoid_pclose(pout_to_fdisk); 1596 paranoid_system("sync");1572 sync(); 1597 1573 log_msg(0,"------------------- fdisk.log looks like this ------------------"); 1598 1574 mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE); 1599 system(tmp); 1575 if (system(tmp)) { 1576 // FIXME 1577 } 1600 1578 mr_free(tmp); 1601 1579 … … 1645 1623 1646 1624 /** pointers **********************************************************/ 1647 char *p;1648 1625 char *part_table_fmt = NULL; 1649 1626 FILE *fout; … … 1676 1653 return (1); 1677 1654 } 1678 1679 1680 p = (char *) strrchr(partition_name, '/');1681 1655 1682 1656 /* BERLIOS: should not be called each time */ … … 1916 1890 1917 1891 /** pointers *********************************************************/ 1918 char *p;1919 1892 FILE *fout; 1920 1893 … … 1928 1901 1929 1902 partition = build_partition_name(drive, partno); 1930 p = (char *) strrchr(partition, '/');1931 1903 if (strcmp(format, "swap") == 0) { 1932 1904 mr_asprintf(partcode, "82"); … … 2169 2141 char *dev; 2170 2142 char *p; 2171 int res;2172 2143 #endif 2173 2144 2174 2145 /** pointers ********************************************************/ 2175 2146 FILE *fin; 2176 char *q;2177 2147 int i; 2178 2148 … … 2233 2203 char *which_format_command_do_i_need(char *format) 2234 2204 { 2235 /** int *************************************************************/2236 int res = 0;2237 2238 2205 /** buffers *********************************************************/ 2239 2206 char *program = NULL; … … 2292 2259 #endif 2293 2260 log_it("Unknown format (%s) - assuming '%s' will do", format, program); 2294 res = 0;2295 2261 } 2296 2262 return (program); … … 2320 2286 float factor; 2321 2287 long long new_size; 2288 char *tmp = NULL; 2322 2289 2323 2290 /** long *************************************************************/ -
branches/3.1/mondo/src/mondorestore/mondo-rstr-compare.c
r3147 r3161 228 228 char *archiver_exe = NULL; 229 229 char *tmp1 = NULL; 230 char *filelist_name = NULL;231 230 char *logfile = NULL; 232 231 char *compressor_exe = NULL; … … 234 233 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 235 234 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 236 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);237 noof_lines = count_lines_in_file(filelist_name);238 mr_free(filelist_name);239 235 240 236 if (strstr(tarball_fname, ".bz2")) { -
branches/3.1/mondo/src/mondorestore/mondo-rstr-newt.c
r3147 r3161 531 531 assert(raidrec != NULL); 532 532 533 system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null"); 533 if (system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null")) { 534 // FIXME 535 } 534 536 personalities = last_line_of_file("/tmp/raid-personalities.txt"); 535 537 mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities); … … 2272 2274 char *q = NULL; 2273 2275 char *r = NULL; 2274 char *s = NULL;2275 2276 char *idev = NULL; 2276 2277 bool ret = FALSE; /* Should be false by default, and modfiy if conditions respected */ -
branches/3.1/mondo/src/mondorestore/mondo-rstr-tools.c
r3148 r3161 80 80 char *incoming = NULL; 81 81 char *question = NULL; 82 char *q;83 char *q;84 82 85 83 assert_string_is_neither_NULL_nor_zerolength(infname); … … 182 180 char *mds = NULL; 183 181 int retval = 0, i; 184 bool already_mounted = FALSE;185 182 char *isodir_format = NULL; 186 183 … … 553 550 mr_free(command); 554 551 555 chdir(bkpinfo->tmpdir); 552 if (chdir(bkpinfo->tmpdir)) { 553 //FIXME 554 } 556 555 557 556 mr_free(mountpt); … … 576 575 if (try_plan_B) { 577 576 log_msg(2, "gcffa --- OK, switching to Plan B"); 578 chdir(bkpinfo->tmpdir); 577 if (chdir(bkpinfo->tmpdir)) { 578 // FIXME 579 } 579 580 run_program_and_log_output("mkdir -p tmp", FALSE); 580 581 … … 1082 1083 char *command = NULL; 1083 1084 char *tmp; 1084 char *tmp1 = NULL;1085 1085 char *q; 1086 1086 int res = 0; … … 1402 1402 bool mntlistchg = FALSE; 1403 1403 FILE *fin = NULL; 1404 bool mntlistchg = FALSE;1405 FILE *fin = NULL;1406 1404 1407 1405 assert_string_is_neither_NULL_nor_zerolength(bd); … … 1436 1434 } 1437 1435 1438 if ((res) || (mntlistchg)){ 1439 popup_and_OK 1440 ("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1441 } else { 1442 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1443 } 1444 if (!g_text_mode) { 1445 newtSuspend(); 1446 } 1447 sprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1448 paranoid_system(tmp); 1449 sprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1450 paranoid_system(tmp); 1451 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1452 sprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1453 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1454 sprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1455 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) { 1456 sprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor); 1457 } 1458 paranoid_system(tmp); 1459 if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) { 1460 sprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1461 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) { 1462 sprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor); 1463 } 1464 paranoid_system(tmp); 1465 if (!g_text_mode) { 1466 newtResume(); 1467 } 1468 sprintf(command, "stabgrub-me %s", boot_device); 1469 res = run_program_and_log_output(command, 1); 1470 if (res) { 1471 popup_and_OK 1472 ("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1473 newtSuspend(); 1474 paranoid_system("chroot " MNT_RESTORING); 1475 newtResume(); 1476 popup_and_OK("Thank you."); 1477 } else { 1478 popup_and_OK("GRUB is now installed correctly"); 1479 done = TRUE; 1480 } 1436 if ((res) || (mntlistchg)) { 1437 popup_and_OK("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1481 1438 } else { 1439 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1440 } 1441 if (!g_text_mode) { 1442 newtSuspend(); 1443 } 1444 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1445 paranoid_system(tmp); 1446 mr_free(tmp); 1447 1448 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1449 paranoid_system(tmp); 1450 mr_free(tmp); 1451 1452 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1453 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1454 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1455 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1456 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) { 1457 mr_asprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor); 1458 } 1459 paranoid_system(tmp); 1460 mr_free(tmp); 1461 1462 if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) { 1463 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1464 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) { 1465 mr_asprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor); 1466 } 1467 paranoid_system(tmp); 1468 mr_free(tmp); 1469 1470 if (!g_text_mode) { 1471 newtResume(); 1472 } 1473 mr_asprintf(command, "stabgrub-me %s", boot_device); 1474 res = run_program_and_log_output(command, 1); 1475 mr_free(command); 1476 if (res) { 1477 popup_and_OK("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1478 newtSuspend(); 1479 paranoid_system("chroot " MNT_RESTORING); 1480 newtResume(); 1481 popup_and_OK("Thank you."); 1482 } else { 1483 popup_and_OK("GRUB is now installed correctly"); 1482 1484 done = TRUE; 1483 1485 } … … 1879 1881 FILE *fout; 1880 1882 char *incoming = NULL; 1881 char *q;1882 char *q;1883 1883 1884 1884 assert_string_is_neither_NULL_nor_zerolength(output_file); -
branches/3.1/mondo/src/mondorestore/mondorestore.c
r3147 r3161 1230 1230 1231 1231 if (strcmp(outfile_fname, "/dev/null")) { 1232 chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid); 1232 if (chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid)) { 1233 // FIXME 1234 } 1233 1235 chmod(outfile_fname, biggiestruct.properties.st_mode); 1234 1236 ubuf->actime = biggiestruct.properties.st_atime; … … 1475 1477 if (strcmp(outfile_fname, "/dev/null")) { 1476 1478 chmod(outfile_fname, biggiestruct.properties.st_mode); 1477 chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid); 1479 if (chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid)) { 1480 // FIXME 1481 } 1478 1482 ubuf->actime = biggiestruct.properties.st_atime; 1479 1483 ubuf->modtime = biggiestruct.properties.st_mtime; -
branches/3.1/mondo/test/test-mountlist.c
r3147 r3161 70 70 71 71 setup_newt_stuff(); 72 mr_asprintf(&g_mountlist_fname, MOUNTLIST_TEST);73 72 log_it("before mountlist"); 74 73 load_mountlist(mountlist, MINDI_CACHE"/mountlist.txt"); … … 96 95 free(raidlist); 97 96 mr_free(MONDO_LOGFILE); 98 mr_free(g_mountlist_fname);99 97 exit(0); 100 98 }
Note:
See TracChangeset
for help on using the changeset viewer.