Ignore:
Timestamp:
Sep 27, 2007, 12:21:18 PM (17 years ago)
Author:
Bruno Cornec
Message:
  • Fix bug #197 (based on an initial patch of Scott Cummings)
  • Fix a bug where df was using locale to print messages and wasn't filtered correctly
  • mkdtemp checked in configure
  • reset_bkpinfo called as early as possible by both main program.
  • It creates a tmpdir cleanly with mkdtemp in setup_tmpdir subfunction, which takes in account TMPIR and TMP env var. Remains to see what tmpfs does and tests
  • configure.in should also be filtered.
  • Remove g_bkpinfo_DONTUSETHIS
  • remove bkpinfo also from header files
  • Render bkpinfo global (potential issue on thread, but should not be a problem as that structure is indeed static during archive)
  • Apply patch from Andree Leidenfrost, modified a bit to use bkpinfo->tmpdir instead of /tmp or MINDI_CACHE when appropriate. Fix security issues in mondo. Thanks al ot Andree for catching all those issues.
  • /tmp => /var/log for mondorestore.log in mindi
  • Update linux terminfo to fix a color issue (Andree Leidenfrost)
  • Removes useless log file (Andree Leidenfrost)
  • replace vi with find_my_editor during restore (Andree Leidenfrost)
  • sync in bg in mindi (VMWare issue to look at)
  • mindi/mindi-busybox have a different version than mondo for pb
  • PB-SUF also added to spec file
  • Fix a bug for pb build (omission of PB-SUF declaration)

(merge -r1631:1662 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/mondoarchive/mondoarchive.c

    r1639 r1663  
    6262/****************** subroutines used only here ******************/
    6363
     64/* Reference to global bkpinfo */
     65struct s_bkpinfo *bkpinfo;
     66
     67/****************** subroutines used only by main.c ******************/
    6468
    6569/**
     
    386390int main(int argc, char *argv[])
    387391{
    388     struct s_bkpinfo *bkpinfo = NULL;
    389392    struct stat stbuf;
    390393    char *tmp = NULL;
     
    399402#endif
    400403    printf(_("Initializing...\n"));
     404
     405    bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));
     406    reset_bkpinfo();
    401407
    402408    /* Reference a dummy cleanup function for mr_exit temporarily */
     
    463469    malloc_libmondo_global_strings();
    464470    diffs = 0;
    465     bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));
    466471    if (stat(MONDO_CACHE, &stbuf) != 0) {
    467472        mr_mkdir(MONDO_CACHE,0x755);
     
    580585    }
    581586
    582     if (pre_param_configuration(bkpinfo)) {
     587    if (pre_param_configuration()) {
    583588        fatal_error
    584589            ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
     
    591596        g_text_mode = FALSE;
    592597        setup_newt_stuff();
    593         res = interactively_obtain_media_parameters_from_user(bkpinfo, TRUE);   /* yes, archiving */
     598        res = interactively_obtain_media_parameters_from_user(TRUE);    /* yes, archiving */
    594599        if (res) {
    595600            fatal_error
     
    597602        }
    598603    } else {
    599         res = handle_incoming_parameters(argc, argv, bkpinfo);
     604        res = handle_incoming_parameters(argc, argv);
    600605        if (res) {
    601606            mr_msg(1,
     
    609614
    610615/* Finish configuring global structures */
    611     if (post_param_configuration(bkpinfo)) {
     616    if (post_param_configuration()) {
    612617        fatal_error
    613618            ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting...");
     
    622627    /* If we're meant to backup then backup */
    623628    if (bkpinfo->backup_data) {
    624         res = backup_data(bkpinfo);
     629        res = backup_data();
    625630        retval += res;
    626631        if (res) {
     
    634639    /* If we're meant to verify then verify */
    635640    if (bkpinfo->verify_data) {
    636         res = verify_data(bkpinfo);
     641        res = verify_data();
    637642        if (res < 0) {
    638643            mr_asprintf(&say_at_end2, _("%d difference%c found."), -res,
     
    657662    }
    658663
    659 
    660     if (length_of_file("/tmp/changed.files") > 2) {
     664    if (length_of_file(MINDI_CACHE"/changed.files") > 2) {
    661665        if (g_text_mode) {
    662666            log_to_screen
    663                 (_("Type 'less /tmp/changed.files' to see which files don't match the archives"));
     667                (_("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives"));
    664668        } else {
    665669            mr_msg(1,
    666                     _("Type 'less /tmp/changed.files' to see which files don't match the archives"));
     670                    _("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives"));
    667671            mr_msg(2, "Calling popup_changelist_from_file()");
    668             popup_changelist_from_file("/tmp/changed.files");
     672            popup_changelist_from_file(MINDI_CACHE"/changed.files");
    669673            mr_msg(2, "Returned from popup_changelist_from_file()");
    670674        }
    671675    } else {
    672         unlink("/tmp/changed.files");
     676        unlink(MINDI_CACHE"/changed.files");
    673677    }
    674678    log_to_screen(say_at_end);
     
    687691
    688692    system("rm -f /var/cache/mondo-archive/last-backup.aborted");
    689     system("rm -Rf /tmp.mondo.* /mondo.scratch.*");
    690693    if (!retval) {
    691694        printf(_("Mondoarchive ran OK.\n"));
     
    698701    chdir("/tmp");              // just in case there's something wrong with g_erase_tmpdir_and_scratchdir
    699702    system(g_erase_tmpdir_and_scratchdir);
     703
     704    /* assemble command string for deletion of Mondo's tmp directory */
     705    sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
     706   
    700707    free_libmondo_global_strings();
    701708    mr_free(bkpinfo);
    702 
    703     unlink("/tmp/filelist.full");
    704     unlink("/tmp/filelist.full.gz");
    705709
    706710    if (!g_cdrom_drive_is_here) {
     
    714718    mr_msg(1, "Time finished: %s", mr_date());
    715719    mr_msg_close();
     720
     721    /* remove Mondo's tmp directory */
     722    system(tmp);
     723    paranoid_free(tmp);
    716724
    717725    if (!g_text_mode) {
Note: See TracChangeset for help on using the changeset viewer.