Changeset 3190 in MondoRescue for branches/3.1/mondo/src/common/libmondo-files.c
- Timestamp:
- Sep 25, 2013, 8:55:43 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/common/libmondo-files.c
r3161 r3190 145 145 fin = popen(command, "r"); 146 146 mr_free(command); 147 147 148 if (fin) { 148 149 if (feof(fin)) { … … 216 217 assert_string_is_neither_NULL_nor_zerolength(inout); 217 218 mr_asprintf(infname, "%s.in", inout); 218 mr_asprintf(outfname, "%s", inout);219 219 mr_asprintf(tmp, "cp -f %s %s", inout, infname); 220 220 run_program_and_log_output(tmp, FALSE); … … 226 226 return; 227 227 } 228 229 mr_asprintf(outfname, "%s", inout); 228 230 if (!(fout = fopen(outfname, "w"))) { 229 231 log_OS_error("Unable to openout outfname"); 232 mr_free(infname); 230 233 mr_free(outfname); 231 234 return; … … 252 255 mr_free(infname); 253 256 } 254 255 256 257 258 259 260 261 257 262 258 … … 271 267 272 268 char *tmp = NULL; 273 char *command = NULL; ;274 char *kernel = NULL; ;269 char *command = NULL; 270 char *kernel = NULL; 275 271 276 272 kernel = call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null",TRUE); … … 308 304 309 305 310 311 312 313 314 306 /** 315 307 * Find location of specified executable in user's PATH. … … 358 350 return (output); 359 351 } 360 361 362 363 364 365 366 352 367 353 … … 659 645 return (0); 660 646 } 661 662 663 647 664 648 … … 1028 1012 fatal_error("Failed to copy LAST-FILELIST-NUMBER to scratchdir"); 1029 1013 } 1014 mr_free(command); 1030 1015 1031 1016 tmp = call_program_and_get_last_line_of_output("which mondorestore",TRUE); … … 1099 1084 1100 1085 /* BERLIOS : there is a bug #67 here as it only considers the first NIC */ 1101 mr_asprintf(command, " ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");1086 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1102 1087 netfs_dev = call_program_and_get_last_line_of_output(command,TRUE); 1103 1088 mr_free(command); … … 1119 1104 mr_free(command); 1120 1105 1106 mr_asprintf(command, "ifconfig %s | head -1 | awk '{print $5}'", netfs_dev); 1107 netfs_client_hwaddr = call_program_and_get_last_line_of_output(command); 1108 mr_free(command); 1109 1110 log_it("netfs_client_hwaddr=%s; netfs_client_ipaddr=%s; netfs_server_ipaddr=%s; netfs_mount=%s", netfs_client_hwaddr, netfs_client_ipaddr, netfs_server_ipaddr, netfs_mount); 1121 1111 if (strlen(netfs_dev) < 2) { 1122 1112 fatal_error("Unable to find ethN (eth0, eth1, ...) adapter via Network mount you specified."); … … 1124 1114 1125 1115 /******** 1126 * If the Network device thatfound above is a bonded device,1116 * If the Network device found above is a bonded device, 1127 1117 * we need to replace it with an ethN device or the 1128 1118 * networking will not start during an Network restore. … … 1153 1143 mr_free(tmp); 1154 1144 1155 mr_asprintf(tmp, "%s/NETFS- SERVER-MOUNT", bkpinfo->tmpdir);1156 write_one_liner_data_file(tmp, bkpinfo->netfs_mount);1157 mr_free( tmp);1158 mr_free( netfs_mount);1145 mr_asprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir); 1146 write_one_liner_data_file(tmp, netfs_client_hwaddr); 1147 mr_free(netfs_client_hwaddr); 1148 mr_free(tmp); 1159 1149 1160 1150 mr_asprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1161 1151 write_one_liner_data_file(tmp, netfs_client_ipaddr); 1162 mr_free(tmp); 1163 1164 mr_asprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir); 1165 write_one_liner_data_file(tmp, netfs_client_hwaddr); 1152 mr_free(netfs_client_ipaddr); 1166 1153 mr_free(tmp); 1167 1154 1168 1155 mr_asprintf(tmp, "%s/NETFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1169 1156 write_one_liner_data_file(tmp, netfs_client_netmask); 1157 mr_free(netfs_client_netmask); 1170 1158 mr_free(tmp); 1171 1159 1172 1160 mr_asprintf(tmp, "%s/NETFS-CLIENT-BROADCAST", bkpinfo->tmpdir); 1173 1161 write_one_liner_data_file(tmp, netfs_client_broadcast); 1162 mr_free(netfs_client_broadcast); 1174 1163 mr_free(tmp); 1175 1164 1176 1165 mr_asprintf(tmp, "%s/NETFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1177 1166 write_one_liner_data_file(tmp, netfs_client_defgw); 1167 mr_free(netfs_client_defgw); 1178 1168 mr_free(tmp); 1179 1169 1180 1170 mr_asprintf(tmp, "%s/NETFS-SERVER-IPADDR", bkpinfo->tmpdir); 1181 1171 write_one_liner_data_file(tmp, netfs_server_ipaddr); 1172 mr_free(netfs_server_ipaddr); 1182 1173 mr_free(tmp); 1183 1174 … … 1198 1189 write_one_liner_data_file(tmp, bkpinfo->prefix); 1199 1190 mr_free(tmp); 1191 1192 sprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir); 1193 write_one_liner_data_file(tmp, bkpinfo->netfs_proto); 1194 mr_free(tmp); 1195 1200 1196 1201 1197 log_it("Finished storing Network configuration"); … … 1228 1224 long long scratchLL; 1229 1225 1230 if (bkpinfo->media_size [1]<= 0) {1226 if (bkpinfo->media_size <= 0) { 1231 1227 log_to_screen("Number of media required: UNKNOWN"); 1232 1228 return; … … 1234 1230 1235 1231 log_it("Estimating number of media required..."); 1236 scratchLL = 1237 (long long) (noof_sets) * (long long) (bkpinfo->optimal_set_size) 1238 + (long long) (size_of_all_biggiefiles_K()); 1239 scratchLL = (scratchLL / 1024) / bkpinfo->media_size[1]; 1232 scratchLL = (long long) (noof_sets) * (long long) (bkpinfo->optimal_set_size) + (long long) (size_of_all_biggiefiles_K()); 1233 scratchLL = (scratchLL / 1024) / bkpinfo->media_size; 1240 1234 scratchLL++; 1241 1235 if (bkpinfo->use_lzo) {
Note:
See TracChangeset
for help on using the changeset viewer.