- Timestamp:
- Nov 18, 2016, 5:31:42 PM (7 years ago)
- Location:
- branches/3.2/mondo/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-archive.c
r3610 r3613 15 15 #include "mr_str.h" 16 16 #include "mr_sys.h" 17 #include "mr_file.h" 17 18 #include "mondostructures.h" 18 19 #include "libmondo-string-EXT.h" … … 1450 1451 char *result_sz = NULL; 1451 1452 char *message_to_screen = NULL; 1452 char *old_pwd ;1453 char *old_pwd = NULL; 1453 1454 char *mds = NULL; 1454 1455 1455 malloc_string(old_pwd);1456 1456 assert(bkpinfo != NULL); 1457 1457 1458 1458 log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir); 1459 tmp1 = getcwd(old_pwd, MAX_STR_LEN - 1);1459 old_pwd = mr_getcwd(); 1460 1460 mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1461 1461 run_program_and_log_output(tmp, FALSE); … … 1533 1533 // FIXME 1534 1534 } 1535 mr_free(old_pwd); 1535 1536 if (retval) { 1536 1537 log_msg(1, "WARNING - make_usb_fs returned an error"); 1537 1538 } 1538 paranoid_free(old_pwd); 1539 return (retval); 1539 return(retval); 1540 1540 } 1541 1541 … … 1558 1558 * @return The number of errors encountered (0 for success) 1559 1559 */ 1560 int make_iso_fs(char *destfile) 1561 { 1560 int make_iso_fs(char *destfile) { 1562 1561 /*@ int ********************************************** */ 1563 1562 int retval = 0; … … 1566 1565 /*@ buffers ****************************************** */ 1567 1566 char *tmp = NULL; 1568 char *tmp2 = NULL; 1569 char *old_pwd; 1567 char *old_pwd = NULL; 1570 1568 char *result_sz = NULL; 1571 1569 char *message_to_screen = NULL; 1572 1570 char *sz_blank_disk = NULL; 1573 char *fnam = NULL;1574 1571 char *isofs_cmd = NULL; 1575 1572 char *full_isofs_cmd = NULL; … … 1578 1575 bool cd_is_mountable; 1579 1576 1580 malloc_string(old_pwd);1581 malloc_string(fnam);1582 1577 assert(bkpinfo != NULL); 1583 1578 assert_string_is_neither_NULL_nor_zerolength(destfile); … … 1588 1583 1589 1584 log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile); 1590 tmp2 = getcwd(old_pwd, MAX_STR_LEN - 1); 1591 if (! tmp2) { 1592 //FIXME 1593 } 1585 old_pwd = mr_getcwd(); 1594 1586 mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1595 1587 run_program_and_log_output(tmp, FALSE); … … 1825 1817 // FIXME 1826 1818 } 1819 mr_free(old_pwd); 1827 1820 if (retval) { 1828 1821 log_msg(1, "WARNING - make_iso_fs returned an error"); 1829 1822 } 1830 paranoid_free(old_pwd);1831 paranoid_free(fnam);1832 paranoid_free(tmp);1833 1823 return (retval); 1834 1824 } -
branches/3.2/mondo/src/common/libmondo-files.c
r3611 r3613 11 11 #include "my-stuff.h" 12 12 #include "mr_mem.h" 13 #include "mr_file.h" 13 14 #include "mondostructures.h" 14 15 #include "libmondo-files.h" … … 1013 1014 char *command = NULL; 1014 1015 char *tmp = NULL; 1015 char old_pwd[MAX_STR_LEN];1016 char *old_pwd = NULL; 1016 1017 int res = 0; 1017 1018 … … 1035 1036 if (does_file_exist(tmp)) { 1036 1037 log_it("Untarring payload %s to scratchdir %s", tmp, bkpinfo->scratchdir); 1037 if (getcwd(old_pwd, MAX_STR_LEN - 1)) { 1038 // FIXME 1039 } 1038 old_pwd = mr_getcwd(); 1040 1039 if (chdir(bkpinfo->scratchdir)) { 1041 1040 // FIXME … … 1052 1051 // FIXME 1053 1052 } 1053 mr_free(old_pwd); 1054 1054 } 1055 1055 mr_free(tmp); -
branches/3.2/mondo/src/common/libmondo-stream.c
r3611 r3613 14 14 #include "my-stuff.h" 15 15 #include "mr_mem.h" 16 #include "mr_file.h" 16 17 #include "mondostructures.h" 17 18 #include "libmondo-devices.h" … … 764 765 char *datablock; 765 766 char *tmp = NULL; 766 char old_cwd[MAX_STR_LEN];767 char *old_pwd = NULL; 767 768 char *outfname = NULL; 768 769 /*@ int ******************************************************* */ … … 865 866 close_evalcall_form(); 866 867 log_it("Saved all.tar.gz to '%s'", outfname); 867 if (getcwd(old_cwd, MAX_STR_LEN)) { 868 // FIXME 869 } 868 old_pwd = mr_getcwd(); 870 869 if (chdir(bkpinfo->tmpdir)) { 871 870 // FIXME … … 876 875 877 876 paranoid_system("cp -f tmp/mondorestore.cfg . 2> /dev/null"); 878 if (chdir(old_ cwd)) {877 if (chdir(old_pwd)) { 879 878 // FIXME 880 879 } 880 mr_free(old_pwd); 881 881 unlink(outfname); 882 882 mr_free(outfname); -
branches/3.2/mondo/src/common/libmondo-tools.c
r3610 r3613 107 107 bool is_valid = TRUE; 108 108 109 log_it("ASSERTION FAILED: `%s' at %s:%d in %s", exp, file, line, 110 function); 109 log_it("ASSERTION FAILED: `%s' at %s:%d in %s", exp, file, line, function); 111 110 if (ignoring_assertions) { 112 111 log_it("Well, the user doesn't care..."); … … 143 142 */ 144 143 case '\n': 145 printf 146 ("(I)gnore, ignore (A)ll, (D)ebug, a(B)ort, or (E)xit? "); 144 printf("(I)gnore, ignore (A)ll, (D)ebug, a(B)ort, or (E)xit? "); 147 145 break; 148 146 default: … … 938 936 if (system("which " MKE2FS_OR_NEWFS " > /dev/null 2> /dev/null")) { 939 937 retval++; 940 log_to_screen 941 ("Unable to find " MKE2FS_OR_NEWFS " in system path."); 942 fatal_error 943 ("Please use \"su -\", not \"su\" to become root. OK? ...and please don't e-mail the mailing list or me about this. Just read the message. :)"); 938 log_to_screen("Unable to find " MKE2FS_OR_NEWFS " in system path."); 939 fatal_error("Please use \"su -\", not \"su\" to become root. OK?\n...and please don't e-mail the mailing list about this. Just read the message. :)"); 944 940 } 945 941 #ifndef __FreeBSD__ 946 if (run_program_and_log_output 947 ("grep ramdisk /proc/devices", FALSE)) { 942 if (run_program_and_log_output("grep ramdisk /proc/devices", FALSE)) { 948 943 /* Some SuSE have ramdisk as modules, so insert it first, then test again */ 949 944 run_program_and_log_output("modprobe brd 2> /dev/null > /dev/null",FALSE); -
branches/3.2/mondo/src/common/libmondo-verify.c
r3380 r3613 418 418 /*@ long *********************************************************** */ 419 419 long diffs = 0; 420 /* getcwd(old_pwd,MAX_STR_LEN-1); */421 420 422 421 assert(bkpinfo != NULL); -
branches/3.2/mondo/src/include/mr_file.h
r3612 r3613 27 27 extern void mr_fclose_int(FILE **fd, int line, char *file); 28 28 extern void mr_mkdir_int(const char *pathname, mode_t mode, int line, char *file); 29 extern char *mr_ mkdir_int(int line, char *file);29 extern char *mr_getcwd_int(int line, char *file); 30 30 31 31 #endif /* MR_FILE_H */ -
branches/3.2/mondo/src/mondorestore/mondo-rstr-compare.c
r3273 r3613 6 6 #include "my-stuff.h" 7 7 #include "mr_mem.h" 8 #include "mr_file.h" 8 9 #include "../common/mondostructures.h" 9 10 #include "../common/libmondo.h" … … 452 453 /** needs malloc *********/ 453 454 char *tmp = NULL; 454 char * cwd, *new;455 char *old_pwd = NULL; 455 456 char *command = NULL; 456 457 int resA = 0; … … 459 460 460 461 malloc_string(tmp); 461 malloc_string(cwd);462 malloc_string(new);463 464 462 assert(bkpinfo != NULL); 465 463 466 if (getcwd(cwd, MAX_STR_LEN - 1)) { 467 // FIXME 468 } 464 old_pwd = mr_getcwd(); 469 465 if (chdir(bkpinfo->restore_path)) { 470 466 //FIXME 471 467 } 472 if (getcwd(new, MAX_STR_LEN - 1)) {473 // FIXME474 }475 468 insist_on_this_cd_number(g_current_media_number); 476 469 unlink(MONDO_CACHE"/changed.txt"); … … 478 471 resA = compare_all_tarballs(); 479 472 resB = compare_all_biggiefiles(); 480 if (chdir( cwd)) {473 if (chdir(old_pwd)) { 481 474 // FIXME 482 475 } 476 mr_free(old_pwd); 477 483 478 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt"); 484 479 if (noof_changed_files) { … … 494 489 mr_free(tmp); 495 490 } 496 497 paranoid_free(cwd);498 paranoid_free(new);499 500 491 return (resA + resB); 501 492 } … … 525 516 long q; 526 517 char *tmp = NULL; 527 char *new; 528 char *cwd; 529 530 malloc_string(new); 531 malloc_string(cwd); 518 char *old_pwd = NULL; 532 519 533 520 /************************************************************************** … … 612 599 613 600 log_msg(2, "calling popup_changelist_from_file()"); 614 if (getcwd(cwd, MAX_STR_LEN - 1)) { 615 //FIXME 616 } 601 old_pwd = mr_getcwd(); 617 602 if (chdir(bkpinfo->restore_path)) { 618 603 // FIXME 619 604 } 620 if (getcwd(new, MAX_STR_LEN - 1)) {621 //FIXME622 }623 605 popup_changelist_from_file(MONDO_CACHE"/changed.files"); 624 if (chdir( cwd)) {606 if (chdir(old_pwd)) { 625 607 // FIXME 626 608 } 609 mr_free(old_pwd); 627 610 log_msg(2, "Returning from popup_changelist_from_file()"); 628 611 } … … 634 617 635 618 kill_petris(); 636 paranoid_free(new);637 paranoid_free(cwd);638 619 return (retval); 639 620 } -
branches/3.2/mondo/src/mondorestore/mondo-rstr-tools.c
r3610 r3613 8 8 #include "mr_mem.h" 9 9 #include "mr_str.h" 10 #include "mr_file.h" 10 11 #include "../common/mondostructures.h" 11 12 #include "../common/libmondo.h" … … 127 128 FILE *fout; 128 129 char *incoming = NULL; 130 char *p = NULL; 129 131 char *question = NULL; 130 132 … … 1012 1014 1013 1015 char *command = NULL; 1014 char * tmp;1016 char *old_pwd = NULL; 1015 1017 char *q; 1016 1018 int res = 0; … … 1019 1021 1020 1022 assert(bkpinfo != NULL); 1021 malloc_string(tmp);1022 1023 1023 1024 /* If those files already exist, do not overwrite them later on */ … … 1035 1036 "Filelist and biggielist already recovered from media. Yay!"); 1036 1037 } else { 1037 if (getcwd(tmp, MAX_STR_LEN) == NULL) { 1038 // FIXME 1039 } 1038 old_pwd = mr_getcwd(); 1040 1039 if (chdir(bkpinfo->tmpdir)) { 1041 1040 // FIXME … … 1113 1112 } 1114 1113 1115 if (chdir( tmp)) {1114 if (chdir(old_pwd)) { 1116 1115 // FIXME 1117 1116 } 1117 mr_free(old_pwd); 1118 1118 1119 1119 if (!does_file_exist(g_biggielist_txt)) { … … 1192 1192 } 1193 1193 1194 paranoid_free(tmp);1195 1194 return (filelist); 1196 1195 } -
branches/3.2/mondo/src/mondorestore/mondorestore.c
r3610 r3613 11 11 #include "my-stuff.h" 12 12 #include "mr_mem.h" 13 #include "mr_file.h" 13 14 #include "../common/mondostructures.h" 14 15 #include "../common/libmondo.h" … … 1746 1747 1747 1748 /** mallco ***/ 1748 char * cwd;1749 char *newpath ;1749 char *old_pwd = NULL; 1750 char *newpath = NULL; 1750 1751 char *tmp = NULL; 1751 1752 assert(bkpinfo != NULL); 1752 1753 1753 malloc_string(cwd);1754 malloc_string(newpath);1755 1754 log_msg(2, "restore_everything() --- starting"); 1756 1755 g_current_media_number = 1; 1757 if (getcwd(cwd, MAX_STR_LEN - 1)) { 1758 // FIXME 1759 } 1756 old_pwd = mr_getcwd(); 1760 1757 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path); 1761 1758 run_program_and_log_output(tmp, FALSE); … … 1766 1763 //FIXME 1767 1764 } 1768 if (getcwd(newpath, MAX_STR_LEN - 1)) { 1769 // FIXME 1770 } 1765 newpath = mr_getcwd(); 1771 1766 log_msg(1, "path is now %s", newpath); 1767 mr_free(newpath); 1768 1772 1769 log_msg(1, "restoring everything"); 1773 1770 if (!find_home_of_exe("petris") && !g_text_mode) { … … 1800 1797 resB = restore_all_biggiefiles_from_CD(filelist); 1801 1798 } 1802 if (chdir( cwd)) {1799 if (chdir(old_pwd)) { 1803 1800 //FIXME 1804 1801 } 1802 mr_free(old_pwd); 1805 1803 if (resA + resB) { 1806 1804 log_to_screen("Errors occurred while data was being restored."); … … 1813 1811 kill_petris(); 1814 1812 log_msg(2, "restore_everything() --- leaving"); 1815 paranoid_free(cwd);1816 paranoid_free(newpath);1817 1813 return (resA + resB); 1818 1814 }
Note:
See TracChangeset
for help on using the changeset viewer.