Changeset 2340


Ignore:
Timestamp:
Aug 21, 2009, 1:53:49 AM (10 years ago)
Author:
bruno
Message:
  • New compiler flogs introduce for memory check
  • Other dyn. allocation added replacing static ones
  • Option -Y is added for LZMA support
Location:
branches/2.2.10
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo-doc/mondoarchive.8

    r2337 r2340  
    170170.TP
    171171.BI "-I " "\*(lqpath ...\*(rq"
    172 Include paths(s) in backup. This option is mainly use to erform tests in order to reduce the time taken by the archiving operation.
     172Include paths(s) in backup. This option is mainly use to perform tests in order to reduce the time taken by the archiving operation.
    173173The default backup path is \*(lq/\*(rq but you may specify alternatives, e.g. -I \*(lq/home /etc\*(rq to override that.
    174174You may also specify full disk device to this option as with -I \*(lq/dev/sda /dev/cciss/c0d0\*(rq
  • branches/2.2.10/mondo/configure.in

    r2246 r2340  
    8080        CFLAGS="$CFLAGS -Wall -Wno-return-type -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_REENTRANT"
    8181        if test "$GCC_MAJ" -ge "4" && test "$GCC_MIN" -ge "2"; then
    82             CFLAGS="$CFLAGS -Werror=format-security"
     82            CFLAGS="$CFLAGS -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector"
    8383        fi
    8484        ;;
     
    127127AC_TYPE_SIGNAL
    128128AC_FUNC_VPRINTF
    129 AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr mkdtemp])
     129AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo getopt setenv strcasecmp strchr strerror strrchr strstr mkdtemp])
    130130
    131131AC_OUTPUT([Makefile src/Makefile src/lib/Makefile src/common/Makefile src/mondoarchive/Makefile src/mondorestore/Makefile src/restore-scripts/Makefile src/restore-scripts/mondo/Makefile src/post-nuke.sample/Makefile src/post-nuke.sample/usr/Makefile src/post-nuke.sample/usr/bin/Makefile test/Makefile])
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2331 r2340  
    211211    char *outfname = NULL;
    212212    char *biggie_fname = NULL;
    213     char *incoming;
     213    char *incoming = NULL;
    214214    char *tmp = NULL;
    215215
     
    257257        return (curr_set_no + 1);
    258258    }
    259     incoming = malloc(MAX_STR_LEN * 2);
    260 
    261     (void) fgets(incoming, MAX_STR_LEN * 2 - 1, fin);
     259
     260    mr_getline(incoming, fin);
    262261    while (!feof(fin)) {
    263262        lino++;
     
    266265            i = 0;
    267266        }
     267        /* Now that we dyn. alloc is truncating needed ?
    268268        if (i > MAX_STR_LEN - 1) {
    269269            incoming[MAX_STR_LEN - 30] = '\0';
     
    271271            err++;
    272272        }
     273        */
    273274        if (incoming[i] < 32) {
    274275            incoming[i] = '\0';
     
    299300                    mr_free(outfname);
    300301                    mr_free(biggie_fname);
    301                     paranoid_free(incoming);
     302                    mr_free(incoming);
    302303                    return (curr_set_no + 1);
    303304                }
     
    305306            }
    306307        }
    307         (void) fgets(incoming, MAX_STR_LEN * 2 - 1, fin);
    308     }
    309     paranoid_free(incoming);
     308        mr_free(incoming);
     309        mr_getline(incoming, fin);
     310    }
     311    mr_free(incoming);
     312
    310313    paranoid_fclose(fin);
    311314    paranoid_fclose(fout);
     
    13321335 * @bug Return value should be @c void.
    13331336 */
    1334 int open_and_list_dir(char *dir1, char *sth, FILE * fout,
    1335                       time_t time_of_last_full_backup)
    1336 {
     1337int open_and_list_dir(char *dir1, char *sth, FILE * fout, time_t time_of_last_full_backup) {
     1338
    13371339    const char delims[] = " ";
    13381340
     
    13411343    struct stat statbuf;
    13421344    char *new;
    1343     char *tmp;
     1345    char *tmp = NULL;
    13441346    char *dir = NULL;
    13451347    static int percentage = 0;
    1346     char *skip_these;
    1347     char *new_with_spaces;
     1348    char *skip_these = NULL;
     1349    char *new_with_spaces = NULL;
    13481350    char *strtmp;
    13491351    char *token;
    1350     char *find_excludes;
    1351     static char *name_of_evalcall_form;
     1352    char *find_excludes = NULL;
     1353    char *name_of_evalcall_form = NULL;
     1354    char *find_skeleton_marker = NULL;
    13521355    int i;
    13531356    int lastpos = 0;
     
    13561359    static int counter = 0;
    13571360    static int uberctr = 0;
    1358     static char *find_skeleton_marker;
    1359     static long skeleton_lino = 0;
    1360     static time_t last_time = 0;
     1361    static long skeleton_lino = 0L;
     1362    static time_t last_time = (time_t)0;
    13611363    time_t this_time;
    13621364
     
    13711373
    13721374    if (!depth) {
    1373         malloc_string(name_of_evalcall_form);
    1374         malloc_string(find_skeleton_marker);
    13751375        mr_asprintf(find_excludes, " ");
    13761376        if (sth != NULL) {
     
    13971397        mr_free(tmp);
    13981398
    1399         sprintf(name_of_evalcall_form, "Making catalog of %s", dir);
     1399        mr_asprintf(name_of_evalcall_form, "Making catalog of %s", dir);
    14001400        open_evalcall_form(name_of_evalcall_form);
    1401         find_skeleton_marker[0] = '\0';
     1401        mr_free(name_of_evalcall_form);
     1402
    14021403        skeleton_lino = 1;
    14031404        log_msg(5, "entries = %ld", g_skeleton_entries);
     
    14051406    } else  // update evalcall form if appropriate
    14061407    {
    1407         sprintf(find_skeleton_marker,
    1408                 "grep -Fv '%s' %s > %s.new 2> /dev/null", dir,
    1409                 g_skeleton_filelist, g_skeleton_filelist);
     1408        mr_asprintf(find_skeleton_marker, "grep -Fv '%s' %s > %s.new 2> /dev/null", dir, g_skeleton_filelist, g_skeleton_filelist);
    14101409        if (!system(find_skeleton_marker)) {
    14111410            percentage = (int) (skeleton_lino * 100 / g_skeleton_entries);
    14121411            skeleton_lino++;
    1413             sprintf(find_skeleton_marker, "mv -f %s.new %s",
    1414                     g_skeleton_filelist, g_skeleton_filelist);
    1415             run_program_and_log_output(find_skeleton_marker, 8);
     1412            mr_free(find_skeleton_marker);
     1413
     1414            mr_asprintf(find_skeleton_marker, "mv -f %s.new %s", g_skeleton_filelist, g_skeleton_filelist);
     1415            (void)system(find_skeleton_marker);
    14161416            time(&this_time);
    14171417            if (this_time != last_time) {
     
    14271427            }
    14281428        }
     1429        mr_free(find_skeleton_marker);
    14291430    }
    14301431
     
    14531454                mr_asprintf(new,"%s%s",dir,dit->d_name);
    14541455            }
    1455             paranoid_free(new_with_spaces);
     1456            mr_free(new_with_spaces);
    14561457            mr_asprintf(new_with_spaces, " %s ", new);
    14571458            if (strstr(skip_these, new_with_spaces)) {
     
    14631464                    if (!S_ISLNK(statbuf.st_mode)
    14641465                        && S_ISDIR(statbuf.st_mode)) {
    1465                         open_and_list_dir(new, skip_these, fout,
    1466                                           time_of_last_full_backup);
     1466                        open_and_list_dir(new, skip_these, fout, time_of_last_full_backup);
    14671467                    } else {
    1468                         if (time_of_last_full_backup == 0
    1469                             || time_of_last_full_backup <
    1470                             statbuf.st_ctime) {
     1468                        if (time_of_last_full_backup == 0 || time_of_last_full_backup < statbuf.st_ctime) {
    14711469                            fprintf(fout, "%s\n", new);
    14721470                            if ((counter++) > 128) {
    14731471                                counter = 0;
    14741472                                uberctr++;
     1473#ifndef _XWIN
    14751474                                mr_asprintf(tmp, " %c ", special_dot_char(uberctr));
    1476 #ifndef _XWIN
    14771475                                if (!g_text_mode) {
    14781476                                    newtDrawRootText(77, g_noof_rows - 3, tmp);
    14791477                                    newtRefresh();
    14801478                                }
     1479                                mr_free(tmp);
    14811480#endif
    1482                                 mr_free(tmp);
    14831481                            }
    14841482                        }
     
    14861484                }
    14871485            }
    1488             paranoid_free(new);
    1489         }
    1490     }
    1491     paranoid_free(new_with_spaces);
    1492     paranoid_free(skip_these);
     1486            mr_free(new);
     1487        }
     1488    }
     1489    mr_free(new_with_spaces);
     1490    mr_free(skip_these);
    14931491    mr_free(dir);
    14941492
     
    15011499    if (!depth) {
    15021500        close_evalcall_form();
    1503         paranoid_free(name_of_evalcall_form);
    1504         paranoid_free(find_skeleton_marker);
    15051501        unlink(g_skeleton_filelist);
    15061502        log_msg(5, "g_skeleton_entries = %ld", g_skeleton_entries);
     
    15961592                                  ("date +%s"));
    15971593    } else if (lstat(sz_datefile, &statbuf)) {
    1598         log_msg(2,
    1599                 "Warning - unable to find date of previous backup. Full backup instead.");
     1594        log_msg(2, "Warning - unable to find date of previous backup. Full backup instead.");
    16001595        differential = 0;
    16011596        time_of_last_full_backup = 0;
     
    16081603// use user-specified filelist (if specified)
    16091604    if (userdef_filelist) {
    1610         log_msg(1,
    1611                 "Using the user-specified filelist - %s - instead of calculating one",
    1612                 userdef_filelist);
     1605        log_msg(1, "Using the user-specified filelist - %s - instead of calculating one", userdef_filelist);
    16131606        mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);
    16141607        if (run_program_and_log_output(command, 3)) {
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2334 r2340  
    378378 * @note This function never returns.
    379379 */
    380     void
    381      finish(int signal) {
     380    void finish(int signal) {
     381
    382382        char *command = NULL;
    383383
     
    393393            mr_free(command);
    394394        }
    395         if (!g_text_mode) {
    396             log_msg(1, "Calling newtFinished()");
    397             newtFinished();
    398         }
    399         printf("Execution run ended; result=%d\n", signal);
    400         printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
    401395        if (bkpinfo->tmpdir) {
    402396            log_msg(8,"tempdir is %s",bkpinfo->tmpdir);
     
    421415        free_libmondo_global_strings();
    422416        free_newt_stuff();
     417        if (!g_text_mode) {
     418            log_msg(1, "Calling newtFinished()");
     419            newtFinished();
     420        }
     421        printf("Execution run ended; result=%d\n", signal);
     422        printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
    423423        exit(signal);
    424424    }
    425 
    426 
    427 
    428425
    429426
     
    998995                mr_free(taskprogress);
    999996            } else {
    1000                 newtScaleSet(g_isoform_scale,
    1001                              (unsigned long long) percentage);
     997                newtScaleSet(g_isoform_scale, (unsigned long long) percentage);
    1002998                if (g_isoform_pcline) {
    1003999                    newtLabelSetText(g_isoform_pcline, pcline_str);
  • branches/2.2.10/mondo/src/include/my-stuff.h

    r2334 r2340  
    88// Extra info for ACLs and SELINUX users
    99#define STAR_ACL_SZ "-xfflags -acl"
    10 //#define STAR_ACL_SZ "-xfflags"
    11 //#define STAR_ACL_SZ ""
    12 // Enable the first line and disable the second if you are a Fedora Core 2 user
    1310
    1411/**
  • branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c

    r2325 r2340  
    3636extern t_bkptype g_backup_media_type;
    3737extern int g_loglevel;
     38extern char *g_magicdev_command;
    3839
    3940/**
     
    7172    char *tmp = NULL;
    7273
    73     log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org",
    74             PACKAGE_VERSION);
     74    log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", PACKAGE_VERSION);
    7575    log_msg(0, "running %s binaries", get_architecture());
    7676    tmp = get_uname_m();
    7777    log_msg(0, "running on %s architecture", tmp);
    7878    mr_free(tmp);
    79     log_msg(0,
    80             "-----------------------------------------------------------");
    81     log_msg(0,
    82             "NB: Mondo logs almost everything, so don't panic if you see");
    83     log_msg(0,
    84             "some error messages.  Please read them carefully before you");
    85     log_msg(0,
    86             "decide to break out in a cold sweat.    Despite (or perhaps");
    87     log_msg(0,
    88             "because of) the wealth of messages. some users are inclined");
    89     log_msg(0,
    90             "to stop reading this log. If Mondo stopped for some reason,");
    91     log_msg(0,
    92             "chances are it's detailed here.  More than likely there's a");
    93     log_msg(0,
    94             "message at the very end of this log that will tell you what");
    95     log_msg(0,
    96             "is wrong. Please read it!                          -Devteam");
    97     log_msg(0,
    98             "-----------------------------------------------------------");
     79    log_msg(0, "-----------------------------------------------------------");
     80    log_msg(0, "NB: Mondo logs almost everything, so don't panic if you see");
     81    log_msg(0, "some error messages.  Please read them carefully before you");
     82    log_msg(0, "decide to break out in a cold sweat.    Despite (or perhaps");
     83    log_msg(0, "because of) the wealth of messages. some users are inclined");
     84    log_msg(0, "to stop reading this log. If Mondo stopped for some reason,");
     85    log_msg(0, "chances are it's detailed here.  More than likely there's a");
     86    log_msg(0, "message at the very end of this log that will tell you what");
     87    log_msg(0, "is wrong. Please read it!                          -Devteam");
     88    log_msg(0, "-----------------------------------------------------------");
    9989
    10090    log_msg(0, "Zero...");
     
    10797    log_msg(7, "Seven...");
    10898    log_msg(8, "Eight...");
    109     printf("See %s for details of backup run.\n", MONDO_LOGFILE);
    11099}
    111100
    112 
    113 extern char *g_magicdev_command;
    114101
    115102/**
     
    174161    printf("Initializing...\n");
    175162
    176     bkpinfo = (struct s_bkpinfo *)mr_malloc(sizeof(struct s_bkpinfo));
    177163    init_bkpinfo();
    178164
     
    316302
    317303    if (pre_param_configuration()) {
    318         fatal_error
    319             ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
    320     }
    321 
    322 /* Process command line, if there is one. If not, ask user for info. */
     304        fatal_error("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting...");
     305    }
     306
     307    /* Process command line, if there is one. If not, ask user for info. */
    323308    if (argc == 1) {
    324309        res = interactively_obtain_media_parameters_from_user(TRUE);    /* yes, archiving */
    325310        if (res) {
    326             fatal_error
    327                 ("Syntax error. Please review the parameters you have supplied and try again.");
     311            fatal_error("Syntax error. Please review the parameters you have supplied and try again.");
    328312        }
    329313    } else {
    330314        res = handle_incoming_parameters(argc, argv);
    331315        if (res) {
    332             printf
    333                 ("Errors were detected in the command line you supplied.\n");
     316            printf("Errors were detected in the command line you supplied.\n");
    334317            printf("Please review the log file - %s\n", MONDO_LOGFILE );
    335318            log_msg(1, "Mondoarchive will now exit.");
  • branches/2.2.10/mondo/src/mondoarchive/mondoarchive.h

    r1967 r2340  
    99 */
    1010char *MONDO_LOGFILE = "/var/log/mondoarchive.log";
    11 char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
     11char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVWYb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
    1212
    1313/* No restriction on ps options */
  • branches/2.2.10/tools/myval

    r2332 r2340  
    33# Call valgrind to test mondo
    44
    5 sudo valgrind --log-file=/tmp/val.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -I /etc -d /home
    6 sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I /etc -E /etc/init.d -d /home
     5sudo valgrind --log-file=/tmp/val.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -I "/etc /var/lib/rpm" -d /home
     6sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I "/etc /var/lib/rpm"  -E /etc/init.d -d /home
     7sudo valgrind --log-file=/tmp/valm.log --tool=massif --heap=yes --stacks=yes --alloc-fn=mr_malloc --massif-out-file=/tmp/valm.out /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I "/etc /var/lib/rpm"  -E /etc/init.d -d /home
     8sudo valgrind --log-file=/tmp/valc.log --tool=callgrind --callgrind-out-file=/tmp/valc.out /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -Y -I "/etc /var/lib/rpm"  -E /etc/init.d -d /home
Note: See TracChangeset for help on using the changeset viewer.