Changeset 2287 in MondoRescue
- Timestamp:
- Jul 21, 2009, 3:26:16 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2279 r2287 543 543 FILE *pin, *pout, *faclin; 544 544 545 log_msg(1, "set_EXAT_list(%s, %s, %s)", orig_msklist, 546 original_exat_fname, executable); 545 log_msg(1, "set_EXAT_list(%s, %s, %s)", orig_msklist, original_exat_fname, executable); 547 546 if (!orig_msklist || !orig_msklist[0] 548 547 || !does_file_exist(orig_msklist)) { … … 556 555 } 557 556 if (length_of_file(original_exat_fname) <= 0) { 558 log_msg(1, 559 "original_exat_fname %s is empty or missing, so no need to set EXAT list", 560 original_exat_fname); 557 log_msg(1, "original_exat_fname %s is empty or missing, so no need to set EXAT list", original_exat_fname); 561 558 return (0); 562 559 } -
branches/2.2.10/mondo/src/common/libmondo-string.c
r2274 r2287 802 802 in_out[i] = '\0'; 803 803 paranoid_free(tmp); 804 /* for(i=strlen(in_out); i>0 && in_out[i-1]<=32; i--) {in_out[i-1]='\0';} */805 804 } 806 805 -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2282 r2287 2185 2185 device[0] = '\0'; 2186 2186 chdir(bkpinfo->tmpdir); 2187 mr_asprintf( cfg_file, "%s", MONDO_CFG_FILE_STUB);2187 mr_asprintf(&cfg_file, "%s", MONDO_CFG_FILE_STUB); 2188 2188 unlink(cfg_file); // cfg_file[] is missing the '/' at the start, FYI, by intent 2189 2189 mr_free(cfg_file); -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2242 r2287 259 259 struct raidlist_itself *raidlist) 260 260 { 261 char c, *tmp; 261 char c; 262 char *tmp = NULL; 262 263 int retval = 0; 263 264 … … 266 267 assert(mountlist != NULL); 267 268 assert(raidlist != NULL); 268 malloc_string(tmp);269 269 log_it("pre wrm"); 270 270 c = which_restore_mode(); … … 280 280 } 281 281 if (g_ISO_restore_mode) { 282 sprintf(tmp, "umount %s", bkpinfo->isodir);282 mr_asprintf(&tmp, "umount %s", bkpinfo->isodir); 283 283 run_program_and_log_output(tmp, FALSE); 284 mr_free(tmp); 284 285 } 285 286 paranoid_MR_finish(0); … … 308 309 retval += compare_mode(mountlist, raidlist); 309 310 } 310 paranoid_free(tmp);311 311 return (retval); 312 312 } … … 439 439 /** needs malloc **********/ 440 440 char *tmp; 441 char *tmp1 = NULL; 441 442 char *fstab_fname; 442 443 char *old_restpath; … … 496 497 if (g_text_mode) { 497 498 save_mountlist_to_disk(mountlist, g_mountlist_fname); 498 sprintf(tmp, "%s %s", find_my_editor(), g_mountlist_fname); 499 res = system(tmp); 499 mr_asprintf(&tmp1, "%s %s", find_my_editor(), g_mountlist_fname); 500 res = system(tmp1); 501 mr_free(tmp1); 500 502 load_mountlist(mountlist, g_mountlist_fname); 501 503 } else { … … 666 668 strcpy(fstab_fname, "/tmp/fstab"); 667 669 } 668 sprintf(tmp,670 mr_asprintf(&tmp1, 669 671 "label-partitions-as-necessary %s < %s >> %s 2>> %s", 670 672 g_mountlist_fname, fstab_fname, MONDO_LOGFILE, 671 673 MONDO_LOGFILE); 672 res = system(tmp); 674 res = system(tmp1); 675 mr_free(tmp1); 673 676 if (res) { 674 677 log_to_screen … … 776 779 bool boot_loader_installed = FALSE; 777 780 /** malloc **/ 778 char tmp[MAX_STR_LEN];779 char *tmpA ;780 char *tmpB ;781 char *tmpC ;781 char *tmp = NULL; 782 char *tmpA = NULL; 783 char *tmpB = NULL; 784 char *tmpC = NULL; 782 785 783 786 assert(bkpinfo != NULL); … … 808 811 } 809 812 if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) { 810 sprintf(tmp,813 mr_asprintf(&tmp, 811 814 "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", 812 815 tmpA, tmpB, tmpC); 813 if (ask_me_yes_or_no(tmp)) { 816 res = ask_me_yes_or_no(tmp); 817 mr_free(tmp); 818 if (res) { 814 819 retval = interactive_mode(mountlist, raidlist); 815 820 goto after_the_nuke; … … 900 905 "Using tune2fs to identify your ext2,3 partitions"); 901 906 902 sprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab", 903 g_mountlist_fname); 907 mr_asprintf(&tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname); 904 908 res = run_program_and_log_output(tmp, TRUE); 909 mr_free(tmp); 905 910 if (res) { 906 911 log_to_screen("label-partitions-as-necessary returned an error"); … … 920 925 ("Please visit our website at http://www.mondorescue.org for more information."); 921 926 } else { 922 strcpy(tmp,"Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 923 popup_and_OK(tmp); 927 mr_asprintf(&tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 928 popup_and_OK(tmp); 929 mr_free(tmp); 924 930 log_to_screen 925 931 ("Mondo has restored your system. Please wait for the command prompt."); … … 930 936 } 931 937 g_I_have_just_nuked = TRUE; 932 /*933 if (!boot_loader_installed && !does_file_exist(DO_MBR_PLEASE))934 {935 log_to_screen("PLEASE RUN 'mondorestore --mbr' NOW TO INITIALIZE YOUR BOOT SECTOR");936 write_one_liner_data_file(DO_MBR_PLEASE, "mondorestore --mbr");937 }938 */939 938 return (retval); 940 939 } … … 1071 1070 1072 1071 /** malloc ***/ 1073 char *checksum, *outfile_fname, *tmp, *bzip2_command, 1074 *ntfsprog_command, *suffix, *sz_devfile; 1072 char *checksum; 1073 char *outfile_fname = NULL; 1074 char *tmp = NULL; 1075 char *bzip2_command = NULL; 1076 char *ntfsprog_command, *suffix; 1077 char *sz_devfile = NULL; 1075 1078 char *bigblk; 1076 1079 char *p; … … 1088 1091 int res = 0; 1089 1092 int old_loglevel; 1090 char sz_msg[MAX_STR_LEN];1091 1093 struct s_node *node; 1092 1094 … … 1096 1098 1097 1099 malloc_string(checksum); 1098 malloc_string(outfile_fname);1099 malloc_string(tmp);1100 malloc_string(bzip2_command);1101 1100 malloc_string(ntfsprog_command); 1102 1101 malloc_string(suffix); 1103 malloc_string(sz_devfile);1104 1102 1105 1103 pathname_of_last_file_restored[0] = '\0'; … … 1124 1122 1125 1123 if (!checksum[0]) { 1126 sprintf(tmp, "Warning - bigfile %ld does not have a checksum", 1127 bigfileno + 1); 1128 log_msg(3, tmp); 1124 log_msg(3, "Warning - bigfile %ld does not have a checksum", bigfileno + 1); 1129 1125 p = checksum; 1130 1126 } … … 1132 1128 if (!strncmp(biggiestruct.filename, "/dev/", 5)) // Whether NTFS or not :) 1133 1129 { 1134 strcpy(outfile_fname, biggiestruct.filename);1130 mr_asprintf(&outfile_fname, "%s", biggiestruct.filename); 1135 1131 } else { 1136 sprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, 1137 biggiestruct.filename); 1132 mr_asprintf(&outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 1138 1133 } 1139 1134 … … 1170 1165 g_loglevel = 4; 1171 1166 use_ntfsprog_hack = TRUE; 1172 log_msg(2, 1173 "Calling ntfsclone in background because %s is an NTFS /dev entry", 1174 outfile_fname); 1175 sprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1167 log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname); 1168 mr_asprintf(&sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1176 1169 (int) (random() % 32768)); 1177 1170 mkfifo(sz_devfile, 0x770); 1178 1171 strcpy(ntfsprog_fifo, sz_devfile); 1172 mr_free(sz_devfile); 1179 1173 file_to_openout = ntfsprog_fifo; 1180 1174 switch (pid = fork()) { … … 1206 1200 } 1207 1201 1208 sprintf(tmp, "Reassembling big file %ld (%s)", bigfileno + 1, 1209 outfile_fname); 1210 log_msg(2, tmp); 1202 log_msg(2, "Reassembling big file %ld (%s)", bigfileno + 1, outfile_fname); 1211 1203 1212 1204 /* … … 1244 1236 g_current_media_number++; 1245 1237 mds = media_descriptor_string(bkpinfo->backup_media_type); 1246 sprintf(tmp, 1247 "Asking for %s #%d so that I may read slice #%ld\n", mds, 1248 g_current_media_number, sliceno); 1249 log_msg(2, tmp); 1250 sprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number); 1238 log_msg(2, "Asking for %s #%d so that I may read slice #%ld\n", mds, g_current_media_number, sliceno); 1251 1239 mr_free(mds); 1252 1240 1241 mr_asprintf(&tmp, "Restoring from %s #%d", mds, g_current_media_number); 1253 1242 log_to_screen(tmp); 1243 mr_free(tmp); 1244 1254 1245 insist_on_this_cd_number(g_current_media_number); 1255 1246 log_to_screen("Continuing to restore."); 1256 1247 } else { 1257 strcpy(tmp, 1258 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1248 mr_asprintf(&tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1259 1249 if (does_file_exist(tmp) && length_of_file(tmp) == 0) { 1260 1250 log_msg(2, … … 1262 1252 bigfileno + 1, sliceno); 1263 1253 finished = TRUE; 1254 mr_free(tmp); 1264 1255 continue; 1265 1256 } else { … … 1267 1258 (slice_fname 1268 1259 (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) { 1269 strcpy(bzip2_command, "lzop");1260 mr_asprintf(&bzip2_command, "lzop"); 1270 1261 strcpy(suffix, "lzo"); 1271 1262 } else … … 1273 1264 (slice_fname 1274 1265 (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) { 1275 strcpy(bzip2_command, "gzip");1266 mr_asprintf(&bzip2_command, "gzip"); 1276 1267 strcpy(suffix, "gz"); 1277 1268 } else … … 1279 1270 (slice_fname 1280 1271 (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1281 strcpy(bzip2_command, "bzip2");1272 mr_asprintf(&bzip2_command, "bzip2"); 1282 1273 strcpy(suffix, "bz2"); 1283 1274 } else … … 1285 1276 (slice_fname 1286 1277 (bigfileno, sliceno, ARCHIVES_PATH, ""))) { 1287 strcpy(bzip2_command, "");1278 mr_asprintf(&bzip2_command, ""); 1288 1279 strcpy(suffix, ""); 1289 1280 } else { 1290 1281 log_to_screen("OK, that's pretty fsck0red..."); 1282 mr_free(tmp); 1291 1283 return (1); 1292 1284 } 1293 1285 } 1294 if (bzip2_command[0] != '\0') { 1295 sprintf(bzip2_command + strlen(bzip2_command), 1296 " -dc %s 2>> %s", 1297 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, 1298 suffix), MONDO_LOGFILE); 1286 mr_free(tmp); 1287 if (bzip2_command != NULL) { 1288 mr_strcat(bzip2_command, " -dc %s 2>> %s", 1289 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1299 1290 } else { 1300 sprintf(bzip2_command, "cat %s 2>> %s", 1301 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, 1302 suffix), MONDO_LOGFILE); 1291 mr_asprintf(&bzip2_command, "cat %s 2>> %s", 1292 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1303 1293 } 1304 1294 mds = media_descriptor_string(bkpinfo->backup_media_type); 1305 sprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds,1295 mr_asprintf(&tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, 1306 1296 g_current_media_number, bigfileno + 1, sliceno); 1307 1297 mr_free(mds); … … 1314 1304 update_progress_form(tmp); 1315 1305 } 1306 mr_free(tmp); 1307 1316 1308 if (!(fbzip2 = popen(bzip2_command, "r"))) { 1317 1309 fatal_error("Can't run popen command"); 1318 1310 } 1311 mr_free(bzip2_command); 1312 1319 1313 while (!feof(fbzip2)) { 1320 1314 siz = fread(bigblk, 1, TAPE_BLOCK_SIZE, fbzip2); 1321 1315 if (siz > 0) { 1322 sprintf(sz_msg, "Read %ld from fbzip2", siz);1323 1316 siz = fwrite(bigblk, 1, siz, fout); 1324 sprintf(sz_msg + strlen(sz_msg),1325 "; written %ld to fout", siz);1326 // log_msg(2. sz_msg);1327 1317 } 1328 1318 } … … 1334 1324 } 1335 1325 } 1336 /*1337 memset(bigblk, TAPE_BLOCK_SIZE, 1); // This all looks very fishy...1338 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1339 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1340 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1341 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1342 */1343 1326 paranoid_fclose(fout); 1344 1327 g_loglevel = old_loglevel; … … 1346 1329 if (use_ntfsprog_hack) { 1347 1330 log_msg(3, "Waiting for ntfsclone to finish"); 1348 sprintf(tmp,1331 mr_asprintf(&tmp, 1349 1332 " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1350 1333 while (system(tmp) == 0) { 1351 1334 sleep(1); 1352 1335 } 1336 mr_free(tmp); 1353 1337 log_it("OK, ntfsclone has really finished"); 1354 1338 } 1355 1339 1356 1340 if (strcmp(outfile_fname, "/dev/null")) { 1357 chown(outfile_fname, biggiestruct.properties.st_uid, 1358 biggiestruct.properties.st_gid); 1341 chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid); 1359 1342 chmod(outfile_fname, biggiestruct.properties.st_mode); 1360 1343 ubuf->actime = biggiestruct.properties.st_atime; … … 1362 1345 utime(outfile_fname, ubuf); 1363 1346 } 1347 mr_free(outfile_fname); 1364 1348 paranoid_free(bigblk); 1365 1349 paranoid_free(checksum); 1366 paranoid_free(outfile_fname);1367 paranoid_free(tmp);1368 paranoid_free(bzip2_command);1369 1350 paranoid_free(ntfsprog_command); 1370 1351 paranoid_free(suffix); 1371 paranoid_free(sz_devfile);1372 1352 1373 1353 return (retval); … … 1404 1384 1405 1385 /** mallocs ********/ 1406 char *tmp; 1407 char *command; 1408 char *outfile_fname; 1386 char *tmp = NULL; 1387 char *tmp1 = NULL; 1388 char *command = NULL; 1389 char *outfile_fname = NULL; 1409 1390 char *ntfsprog_command; 1410 char *sz_devfile ;1391 char *sz_devfile = NULL; 1411 1392 char *ntfsprog_fifo; 1412 1393 char *file_to_openout = NULL; … … 1429 1410 malloc_string(tmp); 1430 1411 malloc_string(ntfsprog_fifo); 1431 malloc_string(outfile_fname);1432 malloc_string(command);1433 malloc_string(sz_devfile);1434 1412 malloc_string(ntfsprog_command); 1435 1413 old_loglevel = g_loglevel; … … 1483 1461 if (use_ntfsprog) { 1484 1462 g_loglevel = 4; 1485 strcpy(outfile_fname, orig_bf_fname);1463 mr_asprintf(&outfile_fname, "%s", orig_bf_fname); 1486 1464 use_ntfsprog_hack = TRUE; 1487 log_msg(2, 1488 "Calling ntfsclone in background because %s is a /dev entry", 1489 outfile_fname); 1490 sprintf(sz_devfile, "%s/%d.%d.000", 1465 log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname); 1466 mr_asprintf(&sz_devfile, "%s/%d.%d.000", 1491 1467 bkpinfo->tmpdir, 1492 1468 (int) (random() % 32768), … … 1494 1470 mkfifo(sz_devfile, 0x770); 1495 1471 strcpy(ntfsprog_fifo, sz_devfile); 1472 mr_free(sz_devfile); 1473 1496 1474 file_to_openout = ntfsprog_fifo; 1497 1475 switch (pid = fork()) { … … 1499 1477 fatal_error("Fork failure"); 1500 1478 case 0: 1501 log_msg(3, 1502 "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", 1503 outfile_fname, ntfsprog_fifo); 1504 res = 1505 feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo); 1506 // log_msg(3, "CHILD - fip - exiting"); 1479 log_msg(3, "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", outfile_fname, ntfsprog_fifo); 1480 res = feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo); 1507 1481 exit(res); 1508 1482 break; 1509 1483 default: 1510 log_msg(3, 1511 "feed_into_ntfsprog() called in background --- pid=%ld", 1512 (long int) (pid)); 1484 log_msg(3, "feed_into_ntfsprog() called in background --- pid=%ld", (long int) (pid)); 1513 1485 } 1514 1486 } else { 1515 if (!strncmp(orig_bf_fname, "/dev/", 5)) // non-NTFS partition 1516 { 1517 strcpy(outfile_fname, orig_bf_fname); 1518 } else // biggiefile 1519 { 1520 sprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, 1521 orig_bf_fname); 1487 if (!strncmp(orig_bf_fname, "/dev/", 5)) { 1488 // non-NTFS partition 1489 mr_asprintf(&outfile_fname, "%s", orig_bf_fname); 1490 } else { 1491 // biggiefile 1492 mr_asprintf(&outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname); 1522 1493 } 1523 1494 use_ntfsprog_hack = FALSE; … … 1528 1499 make_hole_for_file(outfile_fname); 1529 1500 } 1530 sprintf(tmp, "Reassembling big file %ld (%s)", 1531 biggiefile_number + 1, orig_bf_fname); 1532 log_msg(2, tmp); 1501 log_msg(2, "Reassembling big file %ld (%s)", biggiefile_number + 1, orig_bf_fname); 1533 1502 } 1534 1503 1535 1504 if (dummy_restore) { 1536 sprintf(outfile_fname, "/dev/null"); 1505 mr_free(outfile_fname); 1506 mr_asprintf(&outfile_fname, "/dev/null"); 1537 1507 } 1538 1508 1539 1509 if (!bkpinfo->zip_exe[0]) { 1540 sprintf(command, "cat > \"%s\"", file_to_openout);1510 mr_asprintf(&command, "cat > \"%s\"", file_to_openout); 1541 1511 } else { 1542 sprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, 1543 file_to_openout, MONDO_LOGFILE); 1512 mr_asprintf(&command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE); 1544 1513 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1545 1514 /* Ignore SIGPIPE for gzip as it causes errors on big files 1546 * Cf: http://trac.mondorescue.org/ticket/244 1547 */ 1515 * Cf: http://trac.mondorescue.org/ticket/244 */ 1548 1516 signal(SIGPIPE,SIG_IGN); 1549 1517 } 1550 1518 } 1551 sprintf(tmp, "Pipe command = '%s'", command); 1552 log_msg(3, tmp); 1519 log_msg(3, "Pipe command = '%s'", command); 1553 1520 1554 1521 /* restore biggiefile, one slice at a time */ … … 1556 1523 fatal_error("Cannot pipe out"); 1557 1524 } 1525 mr_free(command); 1526 1558 1527 for (res = read_header_block_from_stream(&slice_siz, tmp, &ctrl_chr); 1559 1528 ctrl_chr != BLK_STOP_A_BIGGIE; … … 1562 1531 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 1563 1532 } 1564 sprintf(tmp, "Working on file #%ld, slice #%ld ", 1565 biggiefile_number + 1, current_slice_number); 1566 log_msg(2, tmp); 1533 log_msg(2, "Working on file #%ld, slice #%ld ", biggiefile_number + 1, current_slice_number); 1567 1534 if (!g_text_mode) { 1568 1535 newtDrawRootText(0, g_noof_rows - 2, tmp); … … 1603 1570 if (bkpinfo->zip_exe[0]) { 1604 1571 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1605 /* Re-enable SIGPIPE for gzip 1606 */ 1572 /* Re-enable SIGPIPE for gzip */ 1607 1573 signal(SIGPIPE, terminate_daemon); 1608 1574 } … … 1614 1580 if (use_ntfsprog_hack) { 1615 1581 log_msg(3, "Waiting for ntfsclone to finish"); 1616 sprintf(tmp, 1617 " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1618 while (system(tmp) == 0) { 1582 mr_asprintf(&tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1583 while (system(tmp1) == 0) { 1619 1584 sleep(1); 1620 1585 } 1586 mr_free(tmp1); 1621 1587 log_msg(3, "OK, ntfsclone has really finished"); 1622 1588 } … … 1626 1592 if (strcmp(outfile_fname, "/dev/null")) { 1627 1593 chmod(outfile_fname, biggiestruct.properties.st_mode); 1628 chown(outfile_fname, biggiestruct.properties.st_uid, 1629 biggiestruct.properties.st_gid); 1594 chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid); 1630 1595 ubuf->actime = biggiestruct.properties.st_atime; 1631 1596 ubuf->modtime = biggiestruct.properties.st_mtime; 1632 1597 utime(outfile_fname, ubuf); 1633 1598 } 1599 mr_free(outfile_fname); 1634 1600 1635 1601 paranoid_free(tmp); 1636 paranoid_free(outfile_fname);1637 paranoid_free(command);1638 1602 paranoid_free(ntfsprog_command); 1639 paranoid_free(sz_devfile);1640 1603 paranoid_free(ntfsprog_fifo); 1641 1604 g_loglevel = old_loglevel; … … 1671 1634 /** malloc **/ 1672 1635 char *command = NULL; 1673 char *tmp ;1674 char *filelist_name ;1675 char *filelist_subset_fname ;1676 char *executable ;1677 char *temp_log ;1678 char screen_message[100];1636 char *tmp = NULL; 1637 char *filelist_name = NULL; 1638 char *filelist_subset_fname = NULL; 1639 char *executable = NULL; 1640 char *temp_log = NULL; 1641 char *screen_message = NULL; 1679 1642 long matches = 0; 1680 1643 bool use_star; 1681 char *xattr_fname; 1682 char *acl_fname; 1683 // char files_to_restore_this_time_fname[MAX_STR_LEN]; 1644 char *xattr_fname = NULL; 1645 char *acl_fname = NULL; 1684 1646 1685 1647 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 1686 malloc_string(tmp);1687 malloc_string(filelist_name);1688 malloc_string(filelist_subset_fname);1689 malloc_string(executable);1690 malloc_string(temp_log);1691 malloc_string(xattr_fname);1692 malloc_string(acl_fname);1693 1648 1694 1649 log_msg(5, "Entering"); 1695 filelist_subset_fname[0] = '\0';1696 1650 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1697 // sprintf(files_to_restore_this_time_fname, "/tmp/ftrttf.%d.%d", (int)getpid(), (int)random());1698 1651 mr_asprintf(&command, "mkdir -p %s/tmp", MNT_RESTORING); 1699 1652 run_program_and_log_output(command, 9); 1700 1653 paranoid_free(command); 1701 1654 1702 sprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), 1703 (int) (random() % 32768)); 1704 1705 sprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", 1706 current_tarball_number); 1655 mr_asprintf(&filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number); 1707 1656 if (length_of_file(filelist_name) <= 2) { 1708 log_msg(2, "There are _zero_ files in filelist '%s'", 1709 filelist_name); 1710 log_msg(2, 1711 "This is a bit silly (ask dev-team to fix mondo_makefilelist, please)"); 1712 log_msg(2, 1713 "but it's non-critical. It's cosmetic. Don't worry about it."); 1657 log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name); 1658 log_msg(2, "This is a bit silly (ask dev-team to fix mondo_makefilelist, please)"); 1659 log_msg(2, "but it's non-critical. It's cosmetic. Don't worry about it."); 1714 1660 retval = 0; 1715 goto leave_sub; 1716 } 1717 if (count_lines_in_file(filelist_name) <= 0 1718 || length_of_file(tarball_fname) <= 0) { 1661 mr_free(filelist_name); 1662 log_msg(5, "Leaving"); 1663 return(0); 1664 } 1665 if (count_lines_in_file(filelist_name) <= 0 || length_of_file(tarball_fname) <= 0) { 1719 1666 log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname)); 1720 1667 log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname)); 1721 sprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", 1722 current_tarball_number); 1668 mr_asprintf(&tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1723 1669 log_to_screen(tmp); 1724 retval = 1; 1725 goto leave_sub; 1670 mr_free(tmp); 1671 mr_free(filelist_name); 1672 log_msg(5, "Leaving"); 1673 return(1); 1726 1674 } 1727 1675 1728 1676 if (filelist) { 1729 sprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", 1730 current_tarball_number); 1677 mr_asprintf(&filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number); 1731 1678 if ((matches = 1732 1679 save_filelist_entries_in_common(filelist_name, filelist, 1733 1680 filelist_subset_fname, 1734 use_star)) 1735 <= 0) { 1736 sprintf(tmp, "Skipping fileset %ld", current_tarball_number); 1737 log_msg(1, tmp); 1681 use_star)) <= 0) { 1682 log_msg(1, "Skipping fileset %ld", current_tarball_number); 1738 1683 } else { 1739 log_msg(3, "Saved fileset %ld's subset to %s", 1740 current_tarball_number, filelist_subset_fname); 1741 } 1742 sprintf(screen_message, "Tarball #%ld --- %ld matches", 1684 log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname); 1685 } 1686 mr_asprintf(&screen_message, "Tarball #%ld --- %ld matches", 1743 1687 current_tarball_number, matches); 1744 1688 log_to_screen(screen_message); 1745 } else {1746 filelist_subset_fname[0] = '\0';1747 }1689 mr_free(screen_message); 1690 } 1691 mr_free(filelist_name); 1748 1692 1749 1693 if (filelist == NULL || matches > 0) { 1750 1694 if (g_getfattr) { 1751 sprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, 1752 MNT_CDROM "/archives", current_tarball_number); 1695 mr_asprintf(&xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1753 1696 } 1754 1697 if (g_getfacl) { 1755 sprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", 1756 current_tarball_number); 1698 mr_asprintf(&acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1757 1699 } 1758 1700 if (strstr(tarball_fname, ".bz2")) { 1759 strcpy(executable, "bzip2");1701 mr_asprintf(&executable, "bzip2"); 1760 1702 } else if (strstr(tarball_fname, ".gz")) { 1761 strcpy(executable, "gzip");1703 mr_asprintf(&executable, "gzip"); 1762 1704 } else if (strstr(tarball_fname, ".lzo")) { 1763 strcpy(executable, "lzop");1764 } else {1765 executable[0] = '\0';1766 }1767 if (executable[0]) {1768 sprintf(tmp, "which %s > /dev/null 2> /dev/null", executable);1769 if (run_program_and_log_output(tmp, FALSE)) { 1770 log_to_screen1771 1705 mr_asprintf(&executable, "lzop"); 1706 } 1707 if (executable) { 1708 mr_asprintf(&tmp, "which %s > /dev/null 2> /dev/null", executable); 1709 res = run_program_and_log_output(tmp, FALSE); 1710 mr_free(tmp); 1711 1712 if (res) { 1713 log_to_screen("(compare_a_tarball) Compression program %s not found - oh no!", executable); 1772 1714 paranoid_MR_finish(1); 1773 1715 } 1774 strcpy(tmp, executable); 1775 sprintf(executable, "-P %s -Z", tmp); 1716 tmp = executable; 1717 mr_asprintf(&executable, "-P %s -Z", tmp); 1718 mr_free(tmp); 1776 1719 } 1777 1720 #ifdef __FreeBSD__ … … 1781 1724 #endif 1782 1725 1783 // if (strstr(tarball_fname, ".star."))1784 1726 if (use_star) { 1785 1727 mr_asprintf(&command, … … 1790 1732 } 1791 1733 } else { 1792 if (filelist_subset_fname[0] != '\0') { 1793 mr_asprintf(&command, 1734 if (! executable) { 1735 log_msg(2, "Mo executable, this shouldn't happen !"); 1736 } else { 1737 if (filelist_subset_fname != NULL) { 1738 mr_asprintf(&command, 1794 1739 "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", 1795 1740 TAPE_BLOCK_SIZE, 1796 1741 BUFSIZE, executable, filelist_subset_fname, 1797 // files_to_restore_this_time_fname,1798 1742 tarball_fname); 1799 } else {1800 mr_asprintf(&command,1743 } else { 1744 mr_asprintf(&command, 1801 1745 "afio -i -b %ld -c %ld -M 8m %s %s", 1802 1746 TAPE_BLOCK_SIZE, 1803 1747 BUFSIZE, executable, tarball_fname); 1804 } 1805 } 1748 } 1749 } 1750 } 1751 mr_free(executable); 1806 1752 1807 1753 #undef BUFSIZE 1754 mr_asprintf(&temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768)); 1755 1808 1756 mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log); 1809 1757 log_msg(1, "command = '%s'", command); … … 1829 1777 res = set_fattr_list(filelist_subset_fname, xattr_fname); 1830 1778 if (res) { 1831 log_to_screen 1832 ("Errors occurred while setting extended attributes"); 1779 log_to_screen("Errors occurred while setting extended attributes"); 1833 1780 } else { 1834 1781 log_msg(1, "I set xattr OK"); … … 1860 1807 log_msg(2, "Fileset #%d processed OK", current_tarball_number); 1861 1808 } 1809 unlink(temp_log); 1810 mr_free(temp_log); 1862 1811 } 1863 1812 if (does_file_exist("/PAUSE")) { … … 1866 1815 } 1867 1816 unlink(filelist_subset_fname); 1868 unlink(xattr_fname); 1869 unlink(acl_fname); 1870 unlink(temp_log); 1871 1872 leave_sub: 1873 paranoid_free(tmp); 1874 paranoid_free(filelist_name); 1875 paranoid_free(filelist_subset_fname); 1876 paranoid_free(executable); 1877 paranoid_free(temp_log); 1878 paranoid_free(xattr_fname); 1879 paranoid_free(acl_fname); 1817 mr_free(filelist_subset_fname); 1818 if (g_getfattr) { 1819 unlink(xattr_fname); 1820 mr_free(xattr_fname); 1821 } 1822 if (g_getfacl) { 1823 unlink(acl_fname); 1824 mr_free(acl_fname); 1825 } 1826 1880 1827 log_msg(5, "Leaving"); 1881 1828 return (retval); … … 1913 1860 1914 1861 /** malloc add ***/ 1915 char *tmp;1916 1862 char *mds = NULL; 1917 char *command ;1918 char *afio_fname ;1919 char *filelist_fname ;1920 char *filelist_subset_fname ;1921 char *executable ;1863 char *command = NULL; 1864 char *afio_fname = NULL; 1865 char *filelist_fname = NULL; 1866 char *filelist_subset_fname = NULL; 1867 char *executable = NULL; 1922 1868 long matches = 0; 1923 1869 bool restore_this_fileset = FALSE; … … 1926 1872 assert(bkpinfo != NULL); 1927 1873 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 1928 malloc_string(filelist_subset_fname); 1929 malloc_string(filelist_fname); 1930 malloc_string(afio_fname); 1931 malloc_string(executable); 1932 malloc_string(command); 1933 malloc_string(tmp); 1934 filelist_subset_fname[0] = '\0'; 1874 1935 1875 /* to do it with a file... */ 1936 1876 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1937 1877 mds = media_descriptor_string(bkpinfo->backup_media_type); 1938 sprintf(tmp, 1939 "Restoring from fileset #%ld (%ld KB) on %s #%d", 1878 log_msg(2, "Restoring from fileset #%ld (%ld KB) on %s #%d", 1940 1879 current_tarball_number, (long) size >> 10, mds, g_current_media_number); 1941 1880 mr_free(mds); 1942 1881 1943 log_msg(2, tmp);1944 1882 run_program_and_log_output("mkdir -p " MNT_RESTORING "/tmp", FALSE); 1945 1883 … … 1949 1887 * in afio or someting; oh darn.. OK, use tmpfs :-) * 1950 1888 ****************************************************************************/ 1951 filelist_fname[0] = filelist_subset_fname[0] = '\0'; 1952 sprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", 1953 current_tarball_number); 1954 sprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, 1955 current_tarball_number); 1956 sprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", 1957 bkpinfo->tmpdir, current_tarball_number); 1958 // sprintf(filelist_fname, "/tmp/tmpfs/temp-filelist.%ld", current_tarball_number); 1889 mr_asprintf(&afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number); 1890 mr_asprintf(&filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number); 1891 mr_asprintf(&filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number); 1892 1959 1893 res = read_file_from_stream_to_file(afio_fname, size); 1960 1894 if (strstr(tarball_fname, ".star")) { … … 1965 1899 } 1966 1900 if (bkpinfo->compression_level == 0) { 1967 executable[0] = '\0';1901 mr_asprintf(&executable, "%s", ""); 1968 1902 } else { 1969 1903 if (bkpinfo->use_star) { 1970 strcpy(executable, " -bz");1904 mr_asprintf(&executable, "%s", " -bz"); 1971 1905 } else { 1972 sprintf(executable, "-P %s -Z", bkpinfo->zip_exe);1906 mr_asprintf(&executable, "-P %s -Z", bkpinfo->zip_exe); 1973 1907 } 1974 1908 } … … 1981 1915 if (strstr(tarball_fname, ".star.")) { 1982 1916 use_star = TRUE; 1983 sprintf(command, "star -t file=%s %s", afio_fname, executable);1917 mr_asprintf(&command, "star -t file=%s %s", afio_fname, executable); 1984 1918 } else { 1985 1919 use_star = FALSE; 1986 sprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, 1987 executable, afio_fname); 1988 } 1989 sprintf(command + strlen(command), " > %s 2>> %s", filelist_fname, 1990 MONDO_LOGFILE); 1920 mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname); 1921 } 1922 mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE); 1991 1923 log_msg(1, "command = %s", command); 1992 1924 if (system(command)) { 1993 1925 log_msg(4, "Warning - error occurred while retrieving TOC"); 1994 1926 } 1927 mr_free(command); 1928 1995 1929 if ((matches = 1996 1930 save_filelist_entries_in_common(filelist_fname, filelist, … … 2002 1936 current_tarball_number); 2003 1937 } 2004 sprintf(tmp, "Skipping fileset %ld", current_tarball_number); 2005 log_msg(2, tmp); 1938 log_msg(2, "Skipping fileset %ld", current_tarball_number); 2006 1939 restore_this_fileset = FALSE; 2007 1940 } else { … … 2014 1947 2015 1948 // Concoct the call to star/afio to restore files 2016 if (strstr(tarball_fname, ".star.")) // star2017 {2018 sprintf(command, "star -x file=%s %s", afio_fname, executable);1949 if (strstr(tarball_fname, ".star.")) { 1950 // star 1951 mr_asprintf(&command, "star -x file=%s %s", afio_fname, executable); 2019 1952 if (filelist) { 2020 sprintf(command + strlen(command), " list=%s", 2021 filelist_subset_fname); 2022 } 2023 } else // afio 2024 { 2025 sprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, 2026 executable); 1953 mr_strcat(command, " list=%s", filelist_subset_fname); 1954 } 1955 } else { 1956 // afio 1957 mr_asprintf(&command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable); 2027 1958 if (filelist) { 2028 sprintf(command + strlen(command), " -w %s",2029 filelist_subset_fname);2030 }2031 sprintf(command + strlen(command), " %s", afio_fname);2032 }2033 sprintf(command + strlen(command), " 2>> %s", MONDO_LOGFILE);1959 mr_strcat(command, " -w %s", filelist_subset_fname); 1960 } 1961 mr_strcat(command, " %s", afio_fname); 1962 } 1963 mr_strcat(command, " 2>> %s", MONDO_LOGFILE); 1964 mr_free(executable); 2034 1965 2035 1966 // Call if IF there are files to restore (selectively/unconditionally) … … 2063 1994 log_msg(1, "NOT CALLING '%s'", command); 2064 1995 } 1996 mr_free(command); 2065 1997 2066 1998 if (does_file_exist("/PAUSE") && current_tarball_number >= 50) { … … 2070 2002 2071 2003 unlink(filelist_subset_fname); 2004 mr_free(filelist_subset_fname); 2072 2005 unlink(filelist_fname); 2006 mr_free(filelist_fname); 2073 2007 unlink(afio_fname); 2074 2075 paranoid_free(filelist_subset_fname); 2076 paranoid_free(filelist_fname); 2077 paranoid_free(afio_fname); 2078 paranoid_free(command); 2079 paranoid_free(tmp); 2008 mr_free(afio_fname); 2009 2080 2010 return (retval); 2081 2011 } … … 2105 2035 /** malloc **/ 2106 2036 char *tmp; 2037 char *tmp1 = NULL; 2107 2038 char *mds = NULL; 2108 2039 bool just_changed_cds = FALSE; 2109 char *xattr_fname ;2110 char *acl_fname ;2111 char *biggies_whose_EXATs_we_should_set ; // EXtended ATtributes2040 char *xattr_fname = NULL; 2041 char *acl_fname = NULL; 2042 char *biggies_whose_EXATs_we_should_set = NULL; // EXtended ATtributes 2112 2043 char *pathname_of_last_biggie_restored; 2113 2044 FILE *fbw = NULL; 2114 2045 2115 malloc_string(xattr_fname);2116 malloc_string(acl_fname);2117 2046 malloc_string(tmp); 2118 malloc_string(biggies_whose_EXATs_we_should_set);2119 2047 malloc_string(pathname_of_last_biggie_restored); 2120 2048 assert(bkpinfo != NULL); 2121 2049 2122 sprintf(biggies_whose_EXATs_we_should_set, 2123 "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2050 mr_asprintf(&biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2124 2051 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2125 log_msg(1, "Warning - cannot openout %s", 2126 biggies_whose_EXATs_we_should_set); 2052 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); 2127 2053 } 2128 2054 2129 2055 read_cfg_var(g_mondo_cfg_file, "total-slices", tmp); 2130 2056 total_slices = atol(tmp); 2131 sprintf(tmp, "Reassembling large files "); 2132 mvaddstr_and_log_it(g_currentY, 0, tmp); 2057 mr_asprintf(&tmp1, "Reassembling large files "); 2058 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2059 mr_free(tmp1); 2060 2133 2061 if (length_of_file(BIGGIELIST) < 6) { 2134 2062 log_msg(1, "OK, no biggielist; not restoring biggiefiles"); … … 2137 2065 noof_biggiefiles = count_lines_in_file(BIGGIELIST); 2138 2066 if (noof_biggiefiles <= 0) { 2139 log_msg(2, 2140 "OK, no biggiefiles in biggielist; not restoring biggiefiles"); 2067 log_msg(2, "OK, no biggiefiles in biggielist; not restoring biggiefiles"); 2141 2068 return (0); 2142 2069 } 2143 sprintf(tmp, "OK, there are %ld biggiefiles in the archives", 2144 noof_biggiefiles); 2145 log_msg(2, tmp); 2070 log_msg(2, "OK, there are %ld biggiefiles in the archives", noof_biggiefiles); 2146 2071 2147 2072 open_progress_form("Reassembling large files", … … 2152 2077 log_msg(2, "Thinking about restoring bigfile %ld", bigfileno + 1); 2153 2078 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { 2154 log_msg(3, 2155 "...but its first slice isn't on this CD. Perhaps this was a selective restore?"); 2079 log_msg(3, "...but its first slice isn't on this CD. Perhaps this was a selective restore?"); 2156 2080 mds = media_descriptor_string(bkpinfo->backup_media_type); 2157 log_msg(3, "Cannot find bigfile #%ld 's first slice on %s #%d", 2158 bigfileno + 1, mds, 2159 g_current_media_number); 2081 log_msg(3, "Cannot find bigfile #%ld 's first slice on %s #%d", bigfileno + 1, mds, g_current_media_number); 2160 2082 log_msg(3, "Slicename would have been %s", 2161 2083 slice_fname(bigfileno, 0, ARCHIVES_PATH, "")); … … 2163 2085 if (just_changed_cds) { 2164 2086 just_changed_cds = FALSE; 2165 log_msg(3, 2166 "I'll continue to scan this CD for bigfiles to be restored."); 2087 log_msg(3, "I'll continue to scan this CD for bigfiles to be restored."); 2167 2088 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2168 2089 insist_on_this_cd_number(++g_current_media_number); 2169 sprintf(tmp, "Restoring from %s #%d", mds,2170 g_current_media_number);2171 log_to_screen(tmp);2090 mr_asprintf(&tmp1, "Restoring from %s #%d", mds, g_current_media_number); 2091 log_to_screen(tmp1); 2092 mr_free(tmp1); 2172 2093 just_changed_cds = TRUE; 2173 2094 } else { 2174 2095 /* That big file doesn't exist, but the followings may */ 2175 2096 /* So we need to continue looping */ 2176 log_msg(2, "There was no bigfile #%ld. That's OK.", 2177 bigfileno + 1); 2097 log_msg(2, "There was no bigfile #%ld. That's OK.", bigfileno + 1); 2178 2098 log_msg(2, "I'm going to stop restoring bigfiles now."); 2179 2099 retval++; … … 2183 2103 } else { 2184 2104 just_changed_cds = FALSE; 2185 sprintf(tmp, "Restoring big file %ld", bigfileno + 1);2186 update_progress_form(tmp );2187 res =2188 2105 mr_asprintf(&tmp1, "Restoring big file %ld", bigfileno + 1); 2106 update_progress_form(tmp1); 2107 mr_free(tmp1); 2108 res = restore_a_biggiefile_from_CD(bigfileno, filelist, pathname_of_last_biggie_restored); 2189 2109 log_it("%s",pathname_of_last_biggie_restored); 2190 2110 if (fbw && pathname_of_last_biggie_restored[0]) { … … 2200 2120 fclose(fbw); 2201 2121 if (g_getfattr) { 2202 sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2122 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2203 2123 if (length_of_file(xattr_fname) > 0) { 2204 2124 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2205 2125 } 2126 mr_free(xattr_fname); 2206 2127 } 2207 2128 if (g_getfacl) { 2208 sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2129 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2209 2130 if (length_of_file(acl_fname) > 0) { 2210 2131 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2211 2132 } 2212 } 2213 } 2133 mr_free(acl_fname); 2134 } 2135 } 2136 mr_free(biggies_whose_EXATs_we_should_set); 2137 2214 2138 if (does_file_exist("/PAUSE")) { 2215 popup_and_OK 2216 ("Press ENTER to go on. Delete /PAUSE to stop these pauses."); 2139 popup_and_OK("Press ENTER to go on. Delete /PAUSE to stop these pauses."); 2217 2140 } 2218 2141 close_progress_form(); … … 2222 2145 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2223 2146 } 2224 paranoid_free(xattr_fname);2225 paranoid_free(acl_fname);2226 2147 paranoid_free(tmp); 2227 paranoid_free(biggies_whose_EXATs_we_should_set);2228 2148 paranoid_free(pathname_of_last_biggie_restored); 2229 2149 return (retval); … … 2258 2178 char *mds = NULL; 2259 2179 char *tmp1 = NULL; 2260 char *tarball_fname ;2261 char *progress_str ;2180 char *tarball_fname = NULL; 2181 char *progress_str = NULL; 2262 2182 char *comment; 2263 2183 2264 2184 malloc_string(tmp); 2265 malloc_string(tarball_fname);2266 malloc_string(progress_str);2267 2185 malloc_string(comment); 2268 2186 … … 2270 2188 2271 2189 mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives"); 2272 log_msg(2, 2273 "Insisting on 1st CD, so that I can have a look at LAST-FILELIST-NUMBER"); 2190 log_msg(2, "Insisting on 1st CD, so that I can have a look at LAST-FILELIST-NUMBER"); 2274 2191 if (g_current_media_number != 1) { 2275 2192 log_msg(3, "OK, that's jacked up."); … … 2282 2199 2283 2200 mds = media_descriptor_string(bkpinfo->backup_media_type); 2284 sprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number);2201 mr_asprintf(&progress_str, "Restoring from %s #%d", mds, g_current_media_number); 2285 2202 2286 2203 log_to_screen(progress_str); … … 2292 2209 insist_on_this_cd_number(g_current_media_number); 2293 2210 update_progress_form(progress_str); 2294 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", 2295 current_tarball_number); 2211 mr_free(progress_str); 2212 2213 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number); 2296 2214 if (!does_file_exist(tarball_fname)) { 2297 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz",2298 2215 mr_free(tarball_fname); 2216 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number); 2299 2217 } 2300 2218 if (!does_file_exist(tarball_fname)) { 2301 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo",2302 2219 mr_free(tarball_fname); 2220 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number); 2303 2221 } 2304 2222 if (!does_file_exist(tarball_fname)) { 2305 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.",2306 2223 mr_free(tarball_fname); 2224 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number); 2307 2225 } 2308 2226 if (!does_file_exist(tarball_fname)) { 2309 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2",2310 2227 mr_free(tarball_fname); 2228 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number); 2311 2229 } 2312 2230 if (!does_file_exist(tarball_fname)) { 2313 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.",2314 2231 mr_free(tarball_fname); 2232 mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number); 2315 2233 } 2316 2234 if (!does_file_exist(tarball_fname)) { … … 2318 2236 log_to_screen 2319 2237 ("No tarballs. Strange. Maybe you only backed up freakin' big files?"); 2238 mr_free(tarball_fname); 2320 2239 return (0); 2321 2240 } … … 2327 2246 } 2328 2247 g_current_media_number++; 2329 sprintf(progress_str, "Restoring from %s #%d",2248 mr_asprintf(&progress_str, "Restoring from %s #%d", 2330 2249 media_descriptor_string(bkpinfo->backup_media_type), 2331 2250 g_current_media_number); 2332 2251 log_to_screen(progress_str); 2333 2252 } else { 2334 sprintf(progress_str, "Restoring from fileset #%ld on %s #%d",2253 mr_asprintf(&progress_str, "Restoring from fileset #%ld on %s #%d", 2335 2254 current_tarball_number, mds, g_current_media_number); 2336 // log_msg(3, "progress_str = %s", progress_str);2337 2255 for (res = 999, attempts = 0; attempts < 3 && res != 0; 2338 2256 attempts++) { … … 2364 2282 g_current_progress++; 2365 2283 } 2284 mr_free(tarball_fname); 2366 2285 } 2367 2286 mr_free(mds); 2287 mr_free(progress_str); 2368 2288 2369 2289 close_progress_form(); … … 2373 2293 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2374 2294 } 2375 paranoid_free(tarball_fname);2376 paranoid_free(progress_str);2377 2295 paranoid_free(comment); 2378 2296 … … 2406 2324 /** malloc add ****/ 2407 2325 char *tmp; 2326 char *tmp1; 2408 2327 char *biggie_fname; 2409 2328 char *biggie_cksum; 2410 char *xattr_fname ;2411 char *acl_fname ;2329 char *xattr_fname = NULL; 2330 char *acl_fname = NULL; 2412 2331 char *p; 2413 2332 char *pathname_of_last_biggie_restored; 2414 char *biggies_whose_EXATs_we_should_set ; // EXtended ATtributes2333 char *biggies_whose_EXATs_we_should_set = NULL; // EXtended ATtributes 2415 2334 long long biggie_size; 2416 2335 FILE *fbw = NULL; … … 2419 2338 malloc_string(biggie_fname); 2420 2339 malloc_string(biggie_cksum); 2421 malloc_string(xattr_fname);2422 malloc_string(acl_fname);2423 malloc_string(biggies_whose_EXATs_we_should_set);2424 2340 malloc_string(pathname_of_last_biggie_restored); 2425 2341 assert(bkpinfo != NULL); … … 2428 2344 2429 2345 total_slices = atol(tmp); 2430 sprintf(tmp, "Reassembling large files ");2431 2346 if (g_getfattr) { 2432 sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2347 mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2433 2348 } 2434 2349 if (g_getfacl) { 2435 sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2436 } 2437 mvaddstr_and_log_it(g_currentY, 0, tmp); 2438 sprintf(biggies_whose_EXATs_we_should_set, 2439 "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2350 mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2351 } 2352 mr_asprintf(&tmp1, "Reassembling large files "); 2353 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2354 mr_free(tmp1); 2355 2356 mr_asprintf(&biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2440 2357 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2441 log_msg(1, "Warning - cannot openout %s", 2442 biggies_whose_EXATs_we_should_set); 2443 } 2444 // get xattr and acl files if they're there 2445 res = 2446 read_header_block_from_stream(&biggie_size, biggie_fname, 2447 &ctrl_chr); 2358 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); 2359 } 2360 2361 // get xattr and acl files if they're there 2362 res = read_header_block_from_stream(&biggie_size, biggie_fname, &ctrl_chr); 2448 2363 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2449 2364 res = 2450 read_EXAT_files_from_tape(&biggie_size, biggie_fname, 2451 &ctrl_chr, xattr_fname, acl_fname); 2365 read_EXAT_files_from_tape(&biggie_size, biggie_fname, &ctrl_chr, xattr_fname, acl_fname); 2452 2366 } 2453 2367 2454 2368 noof_biggiefiles = atol(biggie_fname); 2455 sprintf(tmp, "OK, there are %ld biggiefiles in the archives", 2456 noof_biggiefiles); 2457 log_msg(2, tmp); 2369 log_msg(2, "OK, there are %ld biggiefiles in the archives", noof_biggiefiles); 2458 2370 open_progress_form("Reassembling large files", 2459 2371 "I am now reassembling all the large files.", … … 2478 2390 p++; 2479 2391 } 2480 sprintf(tmp, "Restoring big file %ld (%lld K)",2392 mr_asprintf(&tmp1, "Restoring big file %ld (%lld K)", 2481 2393 current_bigfile_number + 1, biggie_size / 1024); 2482 update_progress_form(tmp); 2394 update_progress_form(tmp1); 2395 mr_free(tmp1); 2483 2396 res = restore_a_biggiefile_from_stream(biggie_fname, 2484 2397 current_bigfile_number, … … 2498 2411 if (current_bigfile_number != noof_biggiefiles 2499 2412 && noof_biggiefiles != 0) { 2500 sprintf(tmp, "Warning - bigfileno=%ld but noof_biggiefiles=%ld\n", 2501 current_bigfile_number, noof_biggiefiles); 2413 log_msg(1, "Warning - bigfileno=%ld but noof_biggiefiles=%ld\n", current_bigfile_number, noof_biggiefiles); 2502 2414 } else { 2503 sprintf(tmp, 2504 "%ld biggiefiles in biggielist.txt; %ld biggiefiles processed today.", 2505 noof_biggiefiles, current_bigfile_number); 2506 } 2507 log_msg(1, tmp); 2415 log_msg(1, "%ld biggiefiles in biggielist.txt; %ld biggiefiles processed today.", noof_biggiefiles, current_bigfile_number); 2416 } 2508 2417 2509 2418 if (fbw) { … … 2513 2422 if (g_getfattr) { 2514 2423 if (length_of_file(xattr_fname) > 0) { 2515 log_msg(1, "set_fattr_List(%s,%s)", 2516 biggies_whose_EXATs_we_should_set, xattr_fname); 2517 set_fattr_list(biggies_whose_EXATs_we_should_set, 2518 xattr_fname); 2424 log_msg(1, "set_fattr_List(%s,%s)", biggies_whose_EXATs_we_should_set, xattr_fname); 2425 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2519 2426 } 2520 2427 } 2521 2428 if (g_getfacl) { 2522 2429 if (length_of_file(acl_fname) > 0) { 2523 log_msg(1, "set_acl_list(%s,%s)", 2524 biggies_whose_EXATs_we_should_set, acl_fname); 2430 log_msg(1, "set_acl_list(%s,%s)", biggies_whose_EXATs_we_should_set, acl_fname); 2525 2431 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2526 2432 } … … 2530 2436 } 2531 2437 } 2438 mr_free(xattr_fname); 2439 mr_free(acl_fname); 2440 mr_free(biggies_whose_EXATs_we_should_set); 2441 2532 2442 if (does_file_exist("/PAUSE")) { 2533 2443 popup_and_OK … … 2541 2451 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2542 2452 } 2543 paranoid_free(biggies_whose_EXATs_we_should_set);2544 2453 paranoid_free(pathname_of_last_biggie_restored); 2545 2454 paranoid_free(biggie_fname); 2546 2455 paranoid_free(biggie_cksum); 2547 paranoid_free(xattr_fname);2548 paranoid_free(acl_fname);2549 2456 paranoid_free(tmp); 2550 2457 return (retval); … … 2580 2487 2581 2488 /** malloc **/ 2582 char *tmp ;2489 char *tmp = NULL; 2583 2490 char *mds = NULL; 2584 char *progress_str ;2491 char *progress_str = NULL; 2585 2492 char *tmp_fname; 2586 char *xattr_fname ;2587 char *acl_fname ;2493 char *xattr_fname = NULL; 2494 char *acl_fname = NULL; 2588 2495 2589 2496 long long tmp_size; 2590 2497 2591 malloc_string(tmp);2592 malloc_string(progress_str);2593 2498 malloc_string(tmp_fname); 2594 2499 assert(bkpinfo != NULL); 2595 malloc_string(xattr_fname);2596 malloc_string(acl_fname);2597 2500 mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives"); 2598 2501 read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp); … … 2603 2506 run_program_and_log_output("pwd", 5); 2604 2507 2605 sprintf(progress_str, "Restoring from media #%d", 2606 g_current_media_number); 2508 mr_asprintf(&progress_str, "Restoring from media #%d", g_current_media_number); 2607 2509 log_to_screen(progress_str); 2608 2510 open_progress_form("Restoring from archives", … … 2626 2528 update_progress_form(progress_str); 2627 2529 if (g_getfattr) { 2628 sprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir,2530 mr_asprintf(&xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, 2629 2531 current_afioball_number); 2630 2532 unlink(xattr_fname); 2631 2533 } 2632 2534 if (g_getfacl) { 2633 sprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, 2634 current_afioball_number); 2535 mr_asprintf(&acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2635 2536 unlink(acl_fname); 2636 2537 } 2637 2538 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2638 2539 log_it("Reading EXAT files from tape"); 2639 res = 2640 read_EXAT_files_from_tape(&tmp_size, tmp_fname, 2641 &ctrl_chr, xattr_fname, 2642 acl_fname); 2540 res = read_EXAT_files_from_tape(&tmp_size, tmp_fname, &ctrl_chr, xattr_fname, acl_fname); 2643 2541 } 2644 2542 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 2645 2543 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 2646 2544 } 2647 sprintf(tmp, 2648 "Restoring from fileset #%ld (name=%s, size=%ld K)", 2649 current_afioball_number, tmp_fname, (long) tmp_size >> 10); 2650 res = 2651 restore_a_tarball_from_stream(tmp_fname, 2652 current_afioball_number, 2653 filelist, tmp_size, xattr_fname, 2654 acl_fname); 2545 log_msg(4, "Restoring from fileset #%ld (name=%s, size=%ld K)", current_afioball_number, tmp_fname, (long) tmp_size >> 10); 2546 res = restore_a_tarball_from_stream(tmp_fname, current_afioball_number, filelist, tmp_size, xattr_fname, acl_fname); 2655 2547 retval += res; 2656 2548 if (res) { 2657 sprintf(tmp, "Fileset %ld - errors occurred", 2658 current_afioball_number); 2549 mr_asprintf(&tmp, "Fileset %ld - errors occurred", current_afioball_number); 2659 2550 log_to_screen(tmp); 2551 mr_free(tmp); 2660 2552 } 2661 2553 res = … … 2668 2560 g_current_progress++; 2669 2561 mds = media_descriptor_string(bkpinfo->backup_media_type), 2670 sprintf(progress_str, "Restoring from fileset #%ld on %s #%d", 2671 current_afioball_number, mds,2672 2562 2563 mr_free(progress_str); 2564 mr_asprintf(&progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number); 2673 2565 mr_free(mds); 2674 res = 2675 read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); 2566 res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); 2676 2567 if (g_getfattr) { 2677 2568 unlink(xattr_fname); … … 2681 2572 } 2682 2573 } // next 2574 mr_free(progress_str); 2575 if (g_getfattr) { 2576 mr_free(xattr_fname); 2577 } 2578 if (g_getfacl) { 2579 mr_free(acl_fname); 2580 } 2581 2683 2582 log_msg(1, "All done with afioballs"); 2684 2583 close_progress_form(); … … 2688 2587 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2689 2588 } 2690 paranoid_free(tmp);2691 paranoid_free(progress_str);2692 2589 paranoid_free(tmp_fname); 2693 paranoid_free(xattr_fname);2694 paranoid_free(acl_fname);2695 2590 return (retval); 2696 2591 } … … 2719 2614 char *cwd; 2720 2615 char *newpath; 2721 char *tmp ;2616 char *tmp = NULL; 2722 2617 assert(bkpinfo != NULL); 2723 2618 2724 2619 malloc_string(cwd); 2725 2620 malloc_string(newpath); 2726 malloc_string(tmp);2727 2621 log_msg(2, "restore_everything() --- starting"); 2728 2622 g_current_media_number = 1; 2729 2623 getcwd(cwd, MAX_STR_LEN - 1); 2730 sprintf(tmp, "mkdir -p %s", bkpinfo->restore_path);2624 mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->restore_path); 2731 2625 run_program_and_log_output(tmp, FALSE); 2626 mr_free(tmp); 2627 2732 2628 log_msg(1, "Changing dir to %s", bkpinfo->restore_path); 2733 2629 chdir(bkpinfo->restore_path); … … 2778 2674 paranoid_free(cwd); 2779 2675 paranoid_free(newpath); 2780 paranoid_free(tmp);2781 2676 return (resA + resB); 2782 2677 } … … 2841 2736 int retval = 0; 2842 2737 int res; 2843 // int c; 2844 char *tmp; 2738 char *tmp = NULL; 2845 2739 2846 2740 struct mountlist_itself *mountlist; … … 2861 2755 2862 2756 g_loglevel = DEFAULT_MR_LOGLEVEL; 2863 malloc_string(tmp);2864 2757 2865 2758 /* Configure global variables */ … … 2890 2783 strcpy(g_mondo_home, 2891 2784 call_program_and_get_last_line_of_output("which mondorestore")); 2892 /*2893 sprintf(g_tmpfs_mountpt, "/tmp/tmpfs");2894 make_hole_for_dir(g_tmpfs_mountpt);2895 */2896 2785 g_current_media_number = 1; // precaution 2897 2786 … … 2920 2809 2921 2810 /* Backup original mountlist.txt */ 2922 sprintf(tmp, "%s.orig", g_mountlist_fname);2811 mr_asprintf(&tmp, "%s.orig", g_mountlist_fname); 2923 2812 if (!does_file_exist(g_mountlist_fname)) { 2924 2813 log_msg(2, … … 2926 2815 __LINE__, g_mountlist_fname); 2927 2816 } else if (!does_file_exist(tmp)) { 2928 sprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname,2929 2817 mr_free(tmp); 2818 mr_asprintf(&tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname); 2930 2819 run_program_and_log_output(tmp, FALSE); 2931 2820 } 2821 mr_free(tmp); 2932 2822 2933 2823 /* Init directories */ … … 2982 2872 } 2983 2873 2984 if (argc >= 2 && strcmp(argv[1], "--pih") == 0) {2985 if (system("mount | grep cdrom 2> /dev/null > /dev/null")) {2986 system("mount " MNT_CDROM);2987 }2988 bkpinfo->compression_level = 1;2989 g_current_media_number = 2;2990 strcpy(bkpinfo->restore_path, "/tmp/TESTING");2991 bkpinfo->backup_media_type = dvd;2992 open_progress_form("Reassembling /dev/hda1",2993 "Shark is a bit of a silly person.",2994 "Please wait. This may take some time.",2995 "", 1999);2996 system("rm -Rf /tmp/*pih*");2997 2998 restore_a_biggiefile_from_CD(42, NULL, tmp);2999 }3000 3001 2874 if (argc == 5 && strcmp(argv[1], "--common") == 0) { 3002 2875 g_loglevel = 6; … … 3009 2882 // BERLIOS: /usr/lib ??? 3010 2883 toggle_path_selection(filelist, "/usr/share", TRUE); 3011 // show_filelist(filelist);3012 2884 save_filelist(filelist, "/tmp/out.txt"); 3013 // finish(0);3014 // toggle_path_selection (filelist, "/root/stuff", TRUE);3015 2885 strcpy(a, argv[3]); 3016 2886 strcpy(b, argv[4]); … … 3124 2994 log_msg(2, "Still here. Yay."); 3125 2995 if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) { 3126 sprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir);2996 mr_asprintf(&tmp, "rm -Rf %s/*", bkpinfo->tmpdir); 3127 2997 run_program_and_log_output(tmp, FALSE); 2998 mr_free(tmp); 3128 2999 } 3129 3000 unmount_boot_if_necessary(); /* for Gentoo users */ … … 3148 3019 sprintf(bkpinfo->isodir, "/tmp/isodir"); 3149 3020 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 3150 sprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", 3151 bkpinfo->nfs_mount); 3021 mr_asprintf(&tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount); 3152 3022 run_program_and_log_output(tmp, 1); 3023 mr_free(tmp); 3153 3024 } 3154 3025 } … … 3245 3116 } else { 3246 3117 log_msg(1, "Re-mounted partitions for post-nuke stuff"); 3247 sprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, 3248 retval); 3118 mr_asprintf(&tmp, "post-nuke %s %d", bkpinfo->restore_path, retval); 3249 3119 log_msg(2, "Calling '%s'", tmp); 3250 3120 if ((res = run_program_and_log_output(tmp, 0))) { 3251 3121 log_OS_error(tmp); 3252 3122 } 3123 mr_free(tmp); 3253 3124 log_msg(1, "post-nuke returned w/ res=%d", res); 3254 3125 } … … 3266 3137 set_signals(FALSE); 3267 3138 log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE); 3268 sprintf(tmp, 3269 "Mondo-restore is exiting (retval=%d) ", 3270 retval); 3139 mr_asprintf(&tmp, "Mondo-restore is exiting (retval=%d) ", retval); 3271 3140 log_to_screen(tmp); 3272 sprintf(tmp, "umount %s", bkpinfo->isodir); 3141 mr_free(tmp); 3142 3143 mr_asprintf(&tmp, "umount %s", bkpinfo->isodir); 3273 3144 run_program_and_log_output(tmp, 5); 3145 mr_free(tmp); 3146 3274 3147 paranoid_free(mountlist); 3275 3148 paranoid_free(raidlist); … … 3278 3151 } // for b0rken distros 3279 3152 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 3280 sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);3153 mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir); 3281 3154 system(tmp); 3155 mr_free(tmp); 3282 3156 } 3283 3157 paranoid_MR_finish(retval); // frees global stuff plus bkpinfo … … 3285 3159 paranoid_free(a); 3286 3160 paranoid_free(b); 3287 paranoid_free(tmp);3288 3161 3289 3162 unlink("/tmp/filelist.full");
Note:
See TracChangeset
for help on using the changeset viewer.