Ignore:
Timestamp:
Aug 18, 2009, 2:37:55 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3332@localhost: bruno | 2009-08-07 23:59:34 +0200

  • bkpinfo->tmpchdir is now dynamically allocated
  • reorganize how tmpdir and scratchdir are initialized and the startup of the main sections
  • change of interface for maintain_collection_of_recent_archives, mondo_makefilelist, chop_filelist
  • sensibly_set_tmpdir_and_scratchdir => sensibly_set_scratchdir
  • reset_bkpinfo => init_bkpinfo
  • add function mr_free_bkpinfo
  • Fix a bug in mr_strtok
  • mondoarchive seems to globally work. Newt stuff needs more testing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2320 r2321  
    4242extern char *MONDO_LOGFILE;
    4343
    44 extern void setup_tmpdir(char *path);
    45 
    4644static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = "";
    4745static char g_cdrom_drive_is_here[MAX_STR_LEN / 4] = "";
     
    111109    bool is_this_a_ramdisk = FALSE;
    112110
    113     malloc_string(comment);
    114111    mr_asprintf(&tmp, "%s", where_is_root_mounted());
    115     mr_asprintf(&comment, "root is mounted at %s\n", tmp);
     112    mr_asprintf(&comment, "root is currently mounted at %s\n", tmp);
    116113    log_msg(0, comment);
    117114    mr_free(comment);
    118     log_msg(0,
    119             "No, Schlomo, that doesn't mean %s is the root partition. It's just a debugging message. Relax. It's part of am_I_in_disaster_recovery_mode().",
    120             tmp);
    121115
    122116#ifdef __FreeBSD__
     
    138132    if (is_this_a_ramdisk) {
    139133        if (!does_file_exist("/THIS-IS-A-RAMDISK")) {
    140             log_to_screen
    141                 ("Using /dev/root is stupid of you but I'll forgive you.");
     134            log_to_screen("Using /dev/root is stupid of you but I'll forgive you.");
    142135            is_this_a_ramdisk = FALSE;
    143136        }
     
    146139        is_this_a_ramdisk = TRUE;
    147140    }
    148     log_msg(1, "Is this a ramdisk? result = %d", is_this_a_ramdisk);
     141    log_msg(1, "Is this a ramdisk? result = %s", (is_this_a_ramdisk) ? "TRUE" : "FALSE");
    149142    return (is_this_a_ramdisk);
    150143}
     
    13741367            mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13751368            if (does_file_exist(tmp)) {
    1376                 log_msg(1,
    1377                         "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir",
    1378                         bkpinfo->isodir, bkpinfo->tmpdir);
     1369                log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir);
    13791370                sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir);
    13801371            }
     
    14741465    }
    14751466    */
    1476     log_msg(3, "media type = %s",
    1477             bkptype_to_string(bkpinfo->backup_media_type));
    1478     if (archiving_to_media) {
    1479         sensibly_set_tmpdir_and_scratchdir();
    1480     }
     1467    log_msg(3, "media type = %s", bkptype_to_string(bkpinfo->backup_media_type));
    14811468    bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4;
    14821469    bkpinfo->compression_level =
     
    19711958            finish(1);
    19721959        }
    1973         strcpy(bkpinfo->tmpdir, p);
    1974         mr_free(p);
     1960        mr_free(bkpinfo->tmpdir);
     1961        bkpinfo->tmpdir = p;
    19751962
    19761963        p = popup_and_get_string("Scratch directory", "Please enter your scratch directory.", bkpinfo->scratchdir);
     
    21402127 * @ingroup utilityGroup
    21412128 */
    2142 void sensibly_set_tmpdir_and_scratchdir()
     2129void sensibly_set_scratchdir()
    21432130{
    21442131    char *tmp = NULL;
    21452132    char *command = NULL;
    21462133    char *sz = NULL;
    2147 
    2148     assert(bkpinfo != NULL);
    21492134
    21502135#ifdef __FreeBSD__
     
    21612146    }
    21622147    if (!tmp[0]) {
    2163         fatal_error("I couldn't figure out the tempdir!");
    2164     }
    2165     setup_tmpdir(tmp);
    2166     log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir);
    2167 
     2148        fatal_error("I couldn't figure out the scratchdir!");
     2149    }
    21682150    mr_asprintf(&sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
    21692151    mr_free(bkpinfo->scratchdir);
     
    21712153    log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);
    21722154
    2173     mr_asprintf(&command, "rm -Rf %s/tmp.mondo.* %s/mondo.scratch.*", tmp, tmp);
     2155    mr_asprintf(&command, "rm -Rf %s/mondo.scratch.*", tmp);
    21742156    mr_free(tmp);
    21752157
Note: See TracChangeset for help on using the changeset viewer.