Changeset 87 in MondoRescue


Ignore:
Timestamp:
Oct 27, 2005, 10:03:00 PM (18 years ago)
Author:
bcornec
Message:
  • Now use -Wall to compile
  • asprintf for newt-specific.c
  • Bug in libmondo-string.c line 1120: if we use %% in this format, then the percentage is printeed wrongly (after the real percentage we have a huge number)
Location:
trunk/mondo
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/configure.in

    r41 r87  
    8989    #x86_64*)
    9090        ARCH=i386
    91         CPPFLAGS="$CPPFLAGS -D__IA32__"
     91        CPPFLAGS="$CPPFLAGS -D__IA32__ -Wall"
    9292        ;;
    9393    ia64*)
    9494        ARCH=ia64
    95         CPPFLAGS="$CPPFLAGS -D__IA64__"
     95        CPPFLAGS="$CPPFLAGS -D__IA64__ -Wall"
    9696        ;;
    9797    *)
     
    140140AC_TYPE_SIGNAL
    141141AC_FUNC_VPRINTF
    142 AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr])
     142AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr getline asprintf trunc vasprintf])
    143143
    144144if test -n "$qt_includes"; then
  • trunk/mondo/mondo/common/libmondo-archive.c

    r75 r87  
    22
    33subroutines to handle the archiving of files
    4 
    54*/
    65
     
    514513 * - @c media_size
    515514 * - @c nonbootable_backup
    516  * - @c scratchdir
    517515 * - @c tmpdir
    518516 * - @c use_lzo
     
    528526    /*@ buffer ************************************************************ */
    529527    char *tmp;
    530     char *scratchdir;
    531528    char *command;
    532529    char *use_lzo_sz;
     
    871868
    872869    //  popup_and_OK("Pausing");
    873 
    874870    res = run_program_and_log_to_screen(command,
    875871                                        "Generating boot+data disks");
     
    15081504                (misc_counter_that_is_not_important + 1) % 5;
    15091505            /* BERLIOS: media_usage_comment was NOT initialized !!! */
    1510             /* maybe : */
    1511             asprintf(&media_usage_comment, "%s",
    1512                      percent_media_full_comment(bkpinfo));
     1506            /* maybe  */
     1507            tmp = percent_media_full_comment(bkpinfo);
     1508            asprintf(&media_usage_comment, "%s", tmp);
     1509            paranoid_free(tmp);
    15131510            if (!misc_counter_that_is_not_important) {
    15141511                update_progress_form(media_usage_comment);
     
    15351532                sleep(5);
    15361533            }
    1537             asprintf(&media_usage_comment, "%s",
    1538                      percent_media_full_comment(bkpinfo));
     1534            tmp = percent_media_full_comment(bkpinfo);
     1535            asprintf(&media_usage_comment, "%s", tmp);
     1536            paranoid_free(tmp);
    15391537            /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    15401538            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     
    16441642    char *message_to_screen;
    16451643    char *sz_blank_disk;
    1646     char *fnam;
    16471644    char *tmp2;
    16481645    char *tmp3;
     
    21862183        }
    21872184
    2188         asprintf(&media_usage_comment, "%s",
    2189                  percent_media_full_comment(bkpinfo));
     2185        tmp = percent_media_full_comment(bkpinfo);
     2186        asprintf(&media_usage_comment, "%s", tmp);
     2187        paranoid_free(tmp);
    21902188
    21912189        /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
     
    31673165                             bkpinfo->tmpdir, suffix));
    31683166
    3169         asprintf(&tmp, "%s", percent_media_full_comment(bkpinfo));
     3167        tmp = percent_media_full_comment(bkpinfo);
    31703168        update_progress_form(tmp);
    31713169        paranoid_free(tmp);
     
    33803378    asprintf(&tmp, "Writing the final ISO");
    33813379    log_msg(2, tmp);
    3382     /* BERLIOS: that function seems strange to me
    3383        center_string(tmp, 80);
    3384      */
     3380    /* BERLIOS: center_string is now broken
     3381    center_string(tmp, 80);
     3382    */
    33853383#ifndef _XWIN
    33863384    if (!g_text_mode) {
  • trunk/mondo/mondo/common/libmondo-devices.c

    r86 r87  
    22132213            ("I, Mojo Jojo, shall defeat those pesky Powerpuff Girls!");
    22142214    }
    2215 
    22162215    if (archiving_to_media) {
    22172216
     
    23642363    log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device,
    23652364           bkpinfo->boot_loader);
     2365    log_it("prefix = %s", bkpinfo->prefix);
    23662366    if (bkpinfo->media_size[0] < 0) {
    23672367        if (archiving_to_media) {
     
    28922892    char *command;
    28932893    char *fdisk;
    2894     struct stat buf;
    28952894
    28962895    malloc_string(tmp);
     
    29002899// BERLIOS: Do that temporarily: we need to put back parted2fdisk everywhere
    29012900#ifdef __IA64__
     2901    struct stat buf;
     2902
    29022903    sprintf(fdisk, "/usr/local/bin/fdisk");
    29032904    if (stat(fdisk, &buf) != 0) {
  • trunk/mondo/mondo/common/libmondo-filelist.c

    r59 r87  
    13371337    /*@ int **************************************************** */
    13381338    int res = 0;
    1339 // patch by Herman Kuster
    1340 // end patch
    13411339    int *p_res = &res;
    13421340
    13431341    /*@ buffers ************************************************ */
    1344 //  char command[MAX_STR_LEN*2];
    1345 
    1346     /*@ i don't have any idea ********************************** */
    13471342
    13481343    assert(bkpinfo != NULL);
  • trunk/mondo/mondo/common/libmondo-files.c

    r59 r87  
    699699 * @return The return value of @c mkdir.
    700700 */
     701/* BERLIOS: This function shouldn't call system at all */
    701702int make_hole_for_dir(char *outdir_fname)
    702703{
     
    717718 * @bug Return value unnecessary.
    718719 */
     720/* BERLIOS: This function shouldn't call system at all */
    719721int make_hole_for_file(char *outfile_fname)
    720722{
     
    13101312        sprintf(tmp,
    13111313                "Your backup will probably occupy a single CD/tape/ISO. Maybe two.");
    1312     } else if (scratchLL > 4) {
    1313         sprintf(tmp,
    1314                 "Your backup will occupy one meeeeellion media! (maybe %s)",
    1315                 number_to_text((int) (scratchLL + 1)));
    13161314    } else {
    13171315        sprintf(tmp, "Your backup will occupy approximately %s media.",
  • trunk/mondo/mondo/common/libmondo-mountlist.c

    r59 r87  
    381381    char *tmp;
    382382    char *device;
    383     char *mountpoint;
    384383
    385384    /*@ long *********************************************************** */
  • trunk/mondo/mondo/common/libmondo-raid.c

    r45 r87  
    905905    char *stub;
    906906    char *incoming = NULL;
    907     char *raid_devname;
    908907    char *p, *q, *r;
    909908    int diskno;
  • trunk/mondo/mondo/common/libmondo-string.c

    r58 r87  
    6868/**
    6969 * Pad a string on both sides so it appears centered.
    70  * @param in_out The string to be center-padded (modified).
     70 * @param in_out The string to be center-padded (modified). The caller needs to free this string
    7171 * @param width The width of the final result.
    7272 */
     
    7474{
    7575    char *scratch;
     76    char *out;
    7677    char *p;
    7778    int i;                      /* purpose */
     
    8788    }
    8889    for (p = in_out; *p == ' '; p++);
    89     asprintf(&scratch, "%s", p);
     90    asprintf(&scratch, p);
    9091    len = (int) strlen(scratch);
    9192    mid = width / 2;
     
    9596    }
    9697    in_out[i] = '\0';
    97     strcat(in_out, scratch);
     98    asprintf(&out, "%s%s", in_out, scratch);
    9899    paranoid_free(scratch);
     100    in_out = out;
    99101}
    100102
     
    863865int severity_of_difference(char *fn, char *out_reason)
    864866{
    865     int sev;
     867    int sev = 0;
    866868    char *reason;
    867869    char *filename;
    868870
    869     malloc_string(reason);
    870 // out_reason might be null on purpose, so don't bomb if it is :) OK?
     871    // out_reason might be null on purpose, so don't bomb if it is :) OK?
    871872    assert_string_is_neither_NULL_nor_zerolength(fn);
    872873    if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) {
     
    878879    }
    879880
    880     sev = 3;
    881     sprintf(reason,
    882             "Changed since backup. Consider running a differential backup in a day or two.");
    883881    if (!strncmp(filename, "/var/", 5)) {
    884882        sev = 2;
    885         sprintf(reason,
     883        asprintf(&reason,
    886884                "/var's contents will change regularly, inevitably.");
    887885    }
    888886    if (!strncmp(filename, "/home", 5)) {
    889887        sev = 2;
    890         sprintf(reason,
     888        asprintf(&reason,
    891889                "It's in your /home partiton. Therefore, it is important.");
    892890    }
    893891    if (!strncmp(filename, "/usr/", 5)) {
    894892        sev = 3;
    895         sprintf(reason,
     893        asprintf(&reason,
    896894                "You may have installed/removed software during the backup.");
    897895    }
    898896    if (!strncmp(filename, "/etc/", 5)) {
    899897        sev = 3;
    900         sprintf(reason,
     898        asprintf(&reason,
    901899                "Do not edit config files while backing up your PC.");
    902900    }
     
    904902        || !strcmp(filename, "/etc/mtab")) {
    905903        sev = 1;
    906         sprintf(reason, "This file changes all the time. It's OK.");
     904        asprintf(&reason, "This file changes all the time. It's OK.");
    907905    }
    908906    if (!strncmp(filename, "/root/", 6)) {
    909907        sev = 3;
    910         sprintf(reason, "Were you compiling/editing something in /root?");
     908        asprintf(&reason, "Were you compiling/editing something in /root?");
    911909    }
    912910    if (!strncmp(filename, "/root/.", 7)) {
    913911        sev = 2;
    914         sprintf(reason, "Temp or 'dot' files changed in /root.");
     912        asprintf(&reason, "Temp or 'dot' files changed in /root.");
    915913    }
    916914    if (!strncmp(filename, "/var/lib/", 9)) {
    917915        sev = 2;
    918         sprintf(reason, "Did you add/remove software during backing?");
     916        asprintf(&reason, "Did you add/remove software during backing?");
    919917    }
    920918    if (!strncmp(filename, "/var/lib/rpm", 12)) {
    921919        sev = 3;
    922         sprintf(reason, "Did you add/remove software during backing?");
     920        asprintf(&reason, "Did you add/remove software during backing?");
    923921    }
    924922    if (!strncmp(filename, "/var/lib/slocate", 16)) {
    925923        sev = 1;
    926         sprintf(reason,
     924        asprintf(&reason,
    927925                "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
    928926    }
     
    931929        || !strcmp(filename + strlen(filename) - 4, ".log")) {
    932930        sev = 1;
    933         sprintf(reason,
     931        asprintf(&reason,
    934932                "Log files change frequently as the computer runs. Fret not.");
    935933    }
    936934    if (!strncmp(filename, "/var/spool", 10)) {
    937935        sev = 1;
    938         sprintf(reason,
     936        asprintf(&reason,
    939937                "Background processes or printers were active. This does not affect the integrity of your backup.");
    940938    }
    941939    if (!strncmp(filename, "/var/spool/mail", 10)) {
    942940        sev = 2;
    943         sprintf(reason, "Mail was sent/received during backup.");
     941        asprintf(&reason, "Mail was sent/received during backup.");
    944942    }
    945943    if (filename[strlen(filename) - 1] == '~') {
    946944        sev = 1;
    947         sprintf(reason,
     945        asprintf(&reason,
    948946                "Backup copy of another file which was modified recently.");
    949947    }
    950948    if (strstr(filename, "cache")) {
    951949        sev = 1;
    952         sprintf(reason,
     950        asprintf(&reason,
    953951                "Part of a cache of data. Caches change from time to time. Don't worry.");
    954952    }
     
    958956        || strstr(filename, "/.Xauthority")) {
    959957        sev = 1;
    960         sprintf(reason,
     958        asprintf(&reason,
    961959                "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
    962960    }
    963961    paranoid_free(filename);
    964962
    965     if (out_reason) {
    966         strcpy(out_reason, reason);
    967     }
    968     paranoid_free(reason);
     963    if (sev == 0) {
     964        sev = 3;
     965        asprintf(&reason,
     966            "Changed since backup. Consider running a differential backup in a day or two.");
     967    }
     968
     969    out_reason = reason;
    969970    return (sev);
    970971}
     
    10001001 * - @c bkpinfo->media_size
    10011002 * - @c bkpinfo->scratchdir
    1002  * @return The string indicating media fill.
     1003 * @return The string indicating media fill. Needs to be freed by caller
    10031004 * @note The returned string points to static storage that will be overwritten with each call.
    10041005 */
     
    10061007{
    10071008    /*@ int *********************************************** */
    1008     int percentage;
     1009    int percentage = 0;
     1010    int i;
    10091011    int j;
    10101012
    10111013    /*@ buffers ******************************************* */
    1012     static char outstr[MAX_STR_LEN];
    1013     char *pos_w_commas, *tmp;
     1014    char *outstr;
     1015    char *tmp;
     1016    char *tmp1;
     1017    char *tmp2;
     1018    char *prepstr;
     1019    char *p;
    10141020
    10151021    assert(bkpinfo != NULL);
    1016     malloc_string(pos_w_commas);
    1017     malloc_string(tmp);
    1018     sprintf(tmp, "%lld", g_tape_posK);
    1019     strcpy(pos_w_commas, commarize(tmp));
    1020 
    1021 
    1022 
    1023     if (bkpinfo->media_size[g_current_media_number] <= 0)
    1024 //    { fatal_error( "percentage_media_full_comment() - unknown media size"); }
    1025     {
    1026         sprintf(outstr, "Volume %d: %s kilobytes archived so far",
    1027                 g_current_media_number, pos_w_commas);
     1022
     1023    if (bkpinfo->media_size[g_current_media_number] <= 0) {
     1024        asprintf(&tmp, "%lld", g_tape_posK);
     1025        asprintf(&outstr, "Volume %d: %s kilobytes archived so far",
     1026                g_current_media_number, commarize(tmp));
     1027        paranoid_free(tmp);
    10281028        return (outstr);
    10291029    }
     
    10341034            (int) (g_tape_posK / 10 /
    10351035                   bkpinfo->media_size[g_current_media_number]);
    1036         if (percentage > 100) {
    1037             percentage = 100;
    1038         }
    1039         sprintf(outstr, "Volume %d: [", g_current_media_number);
     1036        asprintf(&prepstr, "Volume %d: [", g_current_media_number);
    10401037    } else {
    10411038        percentage =
    10421039            (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 /
    10431040                   bkpinfo->media_size[g_current_media_number]);
    1044         sprintf(outstr, "%s %d: [",
     1041        asprintf(&prepstr, "%s %d: [",
    10451042                media_descriptor_string(bkpinfo->backup_media_type),
    10461043                g_current_media_number);
    10471044    }
    1048     for (j = 0; j < percentage; j += 5) {
    1049         strcat(outstr, "*");
    1050     }
    1051     for (; j < 100; j += 5) {
    1052         strcat(outstr, ".");
    1053     }
    1054     j = (int) strlen(outstr);
    1055     sprintf(outstr + j, "] %d%% used", percentage);
    1056     paranoid_free(pos_w_commas);
    1057     paranoid_free(tmp);
     1045    if (percentage > 100) {
     1046        percentage = 100;
     1047    }
     1048    j = trunc(percentage/5);
     1049    tmp1 = (char *)malloc((j + 1) * sizeof(char));
     1050    for (i = 0, p = tmp1 ; i < j ; i++, p++) {
     1051            *p = '*';
     1052    }
     1053    *p = '\0';
     1054
     1055    tmp2 = (char *)malloc((20 - j + 1) * sizeof(char));
     1056    for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) {
     1057            *p = '.';
     1058    }
     1059    *p = '\0';
     1060
     1061    /* BERLIOS There is a bug here I can't solve for the moment. If you
     1062     * replace %% in the asprintf below by 'percent' it just works, but
     1063     * like this it creates a huge number. Memory pb somewhere */
     1064    /*
     1065    log_it("percentage: %d", percentage);
     1066    asprintf(&outstr, "%s%s%s] %3d%% used", prepstr, tmp1, tmp2, percentage);
     1067    */
     1068    asprintf(&outstr, "%s%s%s] %3d percent used", prepstr, tmp1, tmp2, percentage);
     1069    paranoid_free(prepstr);
     1070    paranoid_free(tmp1);
     1071    paranoid_free(tmp2);
    10581072    return (outstr);
    10591073}
  • trunk/mondo/mondo/common/libmondo-tools.c

    r75 r87  
    719719        fprintf(stderr, "Type 'man mondoarchive' for help.\n");
    720720    }
    721     sprintf(tmp, "%s", MONDO_TMPISOS);  /* added #define 22 apr 2002 */
     721    sprintf(tmp, "%s", MONDO_TMPISOS);
    722722    if (does_file_exist(tmp)) {
    723723        unlink(tmp);
  • trunk/mondo/mondo/common/libmondo-verify.c

    r59 r87  
    815815
    816816    /*@ buffers ******************************************************** */
    817     char *tmp;
    818817    char *orig_fname, *logical_fname;
    819818    char *comment;
  • trunk/mondo/mondo/common/my-stuff.h

    r59 r87  
    1 /* my-stuff.h
    2    $Id$
    3 .
    4 
    5 
    6 07/14
    7 - ARCH_THREADS is now 2; buffers, 4
    8 
    9 07/10
    10 - added acl, xattr stuff
    11 
    12 06/19
    13 - added AUX_VER
    14 
    15 06/14
    16 - added DO_MBR_PLEASE
    17 
    18 04/17
    19 - replaced INTERNAL_TAPE_BLK_SIZE with g_internal_tape_block_size
    20   and DEFAULT_INTERNAL_TAPE_BLOCK_SIZE
    21 
    22 04/13
    23 - log_msg is now calling standard_log_debug_msg, not the alias (log_debug_msg)
    24 
    25 04/03/2004
    26 - added star and SELINUX support
    27 
    28 11/20/2003
    29 - boot from isolinux.bin, not mindi-boot.2880.img
    30 
    31 11/15
    32 - reduced SLICE_SIZE from 8192 to 4096
    33 
    34 10/08
    35 - set p-i-h volsize to 1GB
    36 
    37 10/21
    38 - added MNT_CDROM and FREELOADER
    39 
    40 10/11
    41 - added DEFAULT_DVD_DISK_SIZE
    42 - added PARTIMAGE_DEBUG_LEVEL
    43 
    44 09/27
    45 - better logging
    46 
    47 09/24
    48 - added MR_LOGFILE="/tmp/mondo-restore.log"
    49 
    50 09/22
    51 - added bool, FALSE, TRUE
    52 
    53 09/20
    54 - increasd PPCFG_RAMDISK_SIZE to 150
    55 
    56 09/12
    57 - reduced MAX_STR_LEN from 512 to 460
    58 
    59 09/10
    60 - moved PPCFG_RAMDISK_SIZE here
    61 
    62 09/05
    63 - better config.h stuff
    64 
    65 06/05
    66 - changed fgrep to grep
    67 
    68 05/19
    69 - added CP_BIN
    70 
    71 05/05
    72 - added #include <sys/param.h> and sys/sem.h and ioctl.h
    73 
    74 05/03
    75 - added kill_anything_like_this()
    76 
    77 04/24/2003
    78 - added *STUB #define's
    79 
    80 11/22/2002
    81 - added INTERNAL_TAPE_BLK_SIZE
    82 
    83 10/10
    84 - use #define to create XMondo-friendly log file name if appropriate
    85 
    86 08/30
    87 - changed ARBITRARY_MAXIMUM to 512
    88 
    89 08/26
    90 - set MAX_STR_LEN at 512 but halved it within many _structures_
    91 - changed ARBITRARY_MAXIMUM to 128
    92 
    93 08/08
    94 - added '#include <signal.h>'
    95 - added WELCOME_STRING
    96 
    97 06/19
    98 - changed tape block size from 8192 to 65536
    99 
    100 04/08
    101 - added manual_cd_tray flag to bkpinfo
    102 
    103 03/31
    104 - added restore_path to struct s_bkpinfo
    105 
    106 03/21
    107 - updated version# to 1.42
    108 
    109 02/20
    110 - added bkpinfo->using_cdstream
    111 
    112 02/06
    113 - added MONDO_VERSION
    114 
    115 02/02
    116 - added MONDO_CFG_FILE
    117 - added SLICE_SIZE
    118 
    119 01/31
    120 - removed MINDI_HOME: it is unnecessary
    121 - replaced MONDO_HOME with variable g_mondo_home
    122 
    123 01/25
    124 - added MONDO_HOME, MINDI_HOME
    125 
    126 01/21
    127 - added s_node{} structure
    128 
    129 01/17
    130 - added sys/shm.h, types.h, ipc.h
    131 
    132 01/02/2002
    133 - added that groovy bkpinfo{} stuff
    134 
    135 11/29/2001
    136 - added raidlist{} struct
    137 
    138 08/27
    139 - stuff
    140 */
     1/* $Id$ */
    1412
    1423#define AUX_VER "2.05_berlios"
    143 
    1444#define HAVE_MALLOC 1
    145 
    1465
    1476// Extra info for ACLs and SELINUX users
     
    15514 * The main header file for Mondo.
    15615 */
     16#ifndef _MY_STUFF_H_
     17#define _MY_STUFF_H_
     18
     19/* Required for the use of asprintf */
     20#define __USE_GNU
     21
     22#include <stdio.h>
    15723
    15824#if !defined(bool) && !defined(__cplusplus)
     
    16531#endif
    16632
    167 #ifndef _MY_STUFF_H_
    168 #define _MY_STUFF_H_
    169 
    17033#ifdef HAVE_CONFIG_H
    17134#include <config.h>
     
    17538#include <getopt.h>
    17639#endif
     40
    17741#include <sys/types.h>
    17842#include <sys/shm.h>
     
    18145#include <sys/sem.h>
    18246#include <sys/param.h>
    183 #include <stdio.h>
     47
    18448#include <stdlib.h>
    18549#ifndef  __USE_FILE_OFFSET64
     
    528392#define DEFAULT_MR_LOGLEVEL 4
    529393
    530 /* Required for the use of asprintf */
    531 #define _GNU_SOURCE
    532 
    533394#endif                          /* _MY_STUFF_H_ */
  • trunk/mondo/mondo/common/newt-specific.c

    r75 r87  
    4949    bool g_exiting = FALSE;
    5050
    51 /**
    52  * Padding below the Newt components, to overcome bugs in Newt.
    53  */
    54     char g_haharrrrr[500];
    55 
    56 
    5751    newtComponent g_timeline = NULL,    ///< The line of the progress form that shows the time elapsed/remaining
    5852        g_percentline = NULL,   ///< The line of the progress form that shows the percent completed/remaining
     
    6761 * Padding above the Newt components, to overcome bugs in Newt.
    6862 */
    69     char g_jim_lad_yarr[500];
    7063    char **err_log_lines = NULL,    ///< The list of log lines to show on the screen.
    71         g_blurb_str_1[MAX_NEWT_COMMENT_LEN] = "",   ///< The string for line 1 of the blurb in the progress form
    72         g_blurb_str_2[MAX_NEWT_COMMENT_LEN] = "",   ///< The string for line 2 of the blurb in the progress form
    73         g_blurb_str_3[MAX_NEWT_COMMENT_LEN] = "";   ///< The string for line 3 (updated continuously) of the blurb in the progress form
     64        *g_blurb_str_1, ///< The string for line 1 of the blurb in the progress form
     65        *g_blurb_str_2, ///< The string for line 2 of the blurb in the progress form
     66        *g_blurb_str_3; ///< The string for line 3 (updated continuously) of the blurb in the progress form
    7467    newtComponent g_isoform_main = NULL,    ///< The evalcall form component itself
    7568        g_isoform_header = NULL,    ///< The component for the evalcall form title
     
    7972    long g_isoform_starttime;   ///< The time (in seconds since the epoch) that the evalcall form was opened.
    8073    int g_isoform_old_progress = -1;    ///< The most recent progress update of the evalcall form (percent).
    81     char g_isoform_header_str[MAX_STR_LEN] = "                                                                                                               "; ///< The string for the evalcall form title.
     74    char *g_isoform_header_str; ///< The string for the evalcall form title.
    8275    int g_mysterious_dot_counter;   ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3
    8376    int g_noof_log_lines = 6;   ///< The number of lines to show in the log at the bottom of the screen.
     
    9184    long g_start_time = 0;      ///< The time (in seconds since the epoch) that the progress form was opened.
    9285    bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
    93     char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN],  ///< ... @bug Unneeded w/current XMondo.
    94      g_xmondo_stdout[MAX_NEWT_COMMENT_LEN]; ///< .... @bug Unneeded w/current XMondo.
    9586    bool g_called_by_xmondo = FALSE;    ///< @bug Unneeded w/current XMondo.
    9687    char *g_erase_tmpdir_and_scratchdir;    ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo.
     
    255246     fatal_error(char *error_string) {
    256247        /*@ buffers ***************************************************** */
    257         char fatalstr[MAX_NEWT_COMMENT_LEN] =
    258             "-------FATAL ERROR---------";
     248        char *fatalstr;
    259249        char *tmp;
    260250        char *command;
     
    264254        /*@ end vars **************************************************** */
    265255
    266         malloc_string(command);
     256        asprintf(&fatalstr, "-------FATAL ERROR---------");
    267257        set_signals(FALSE);     // link to external func
    268258        g_exiting = TRUE;
    269         log_msg(1, "Fatal error received - '%s'", error_string);
    270         printf("Fatal error... %s\n", error_string);
     259        log_msg(1, "%s - '%s'", fatalstr, error_string);
     260        printf("%s - %s\n", fatalstr, error_string);
    271261        if (getpid() == g_mastermind_pid) {
    272262            log_msg(2, "mastermind %d is exiting", (int) getpid());
     
    323313        }
    324314
    325         printf("---FATALERROR--- %s\n", error_string);
    326315        system
    327316            ("cat /var/log/mondo-archive.log | gzip -9 > /tmp/MA.log.gz 2> /dev/null");
    328317        if (!strstr(g_version, "cvs") && !strstr(g_version, "svn")) {
    329318            printf
    330                 ("Please try the snapshot (the version with 'cvs' and the date in its filename)");
     319                ("Please try the latest SVN version ");
    331320            printf
    332                 ("to see if that fixes the problem. Please don't bother the mailing list with");
     321                ("to see if that fixes the problem.\nPlease don't bother the mailing list with");
    333322            printf
    334                 ("your problem UNTIL you've tried the snapshot. The snapshot contains bugfixes");
     323                ("your problem UNTIL you've tried the snapshot.\nThe snapshot contains bugfixes");
    335324            printf
    336                 ("which might help you. Go to http://www.mondorescue.org/download/download.html");
    337             printf("For more information.\n");
     325                ("which might help you.\nGo to http://mondorescue.berlios.de");
     326            printf(" for more information.\n");
    338327            log_msg(0,
    339328                    "Please DON'T contact the mailing list. Try the SNAPSHOTS.");
     
    565554        g_isoform_old_progress = -1;
    566555        g_mysterious_dot_counter = 0;
    567         malloc_string(title);
    568         malloc_string(tmp);
    569556
    570557        assert(ttl != NULL);
    571         strcpy(title, ttl);
    572         strcpy(g_isoform_header_str, title);
    573 //  center_string (title, 80);
     558        asprintf(&title, ttl);
     559        // BERLIOS: We need to unallocate it somewhere
     560        asprintf(&g_isoform_header_str, title);
     561        //  center_string (title, 80);
    574562        if (g_text_mode) {
    575563            log_msg(0, title);
    576564        } else {
    577             strcpy(tmp, title);
    578             center_string(tmp, 80);
     565            asprintf(&tmp, title);
     566            /* BERLIOS: center_string is now broken replace it ! */
     567            //center_string(tmp, 80);
    579568            newtPushHelpLine(tmp);
    580         }
    581         center_string(g_isoform_header_str, 36);
     569            paranoid_free(tmp);
     570        }
     571        /* BERLIOS: center_string is now broken replace it ! */
     572        //center_string(g_isoform_header_str, 36);
    582573        g_isoform_starttime = get_time();
    583574        if (g_text_mode) {
     
    597588        }
    598589        update_evalcall_form(0);
    599         paranoid_free(tmp);
    600590        paranoid_free(title);
    601591    }
     
    625615        g_mysterious_dot_counter = 0;
    626616
    627         malloc_string(b1c);
    628         malloc_string(blurb1);
    629         malloc_string(blurb2);
    630         malloc_string(blurb3);
    631 
    632617        assert(title != NULL);
    633618        assert(b1 != NULL);
     
    635620        assert(b3 != NULL);
    636621
    637         strcpy(blurb1, b1);
    638         strcpy(blurb2, b2);
    639         strcpy(blurb3, b3);
    640         strcpy(b1c, b1);
    641         center_string(b1c, 80);
     622        asprintf(&blurb1, b1);
     623        asprintf(&blurb2, b2);
     624        asprintf(&blurb3, b3);
     625        asprintf(&b1c, b1);
     626        /* BERLIOS: center_string is now broken replace it ! */
     627        //center_string(b1c, 80);
    642628        if (max_val <= 0) {
    643629            max_val = 1;
     
    647633        g_maximum_progress = max_val;
    648634        g_current_progress = 0;
    649         strcpy(g_blurb_str_1, blurb1);
    650         strcpy(g_blurb_str_2, blurb3);
    651         strcpy(g_blurb_str_3, blurb2);
     635        // BERLIOS: We need to unallocate them
     636        asprintf(&g_blurb_str_1, blurb1);
     637        asprintf(&g_blurb_str_2, blurb3);
     638        asprintf(&g_blurb_str_3, blurb2);
    652639        if (g_text_mode) {
    653640            log_msg(0, blurb1);
     
    724711        char *original_contents;
    725712
    726         blurb = malloc(MAX_NEWT_COMMENT_LEN);
    727         original_contents = malloc(MAX_NEWT_COMMENT_LEN);
    728713        assert_string_is_neither_NULL_nor_zerolength(title);
    729714        assert(b != NULL);
     
    737722            if (output[strlen(output) - 1] == '\n')
    738723                output[strlen(output) - 1] = '\0';
    739             paranoid_free(blurb);
    740             paranoid_free(original_contents);
    741724            return (TRUE);
    742725        }
    743         strcpy(blurb, b);
     726        asprintf(&blurb, b);
    744727        text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0);
    745         strcpy(original_contents, output);
     728        asprintf(&original_contents, output);
    746729        output[0] = '\0';
    747730        type_here =
     
    760743        myForm = newtForm(NULL, NULL, 0);
    761744        newtFormAddComponents(myForm, text, type_here, b_1, b_2, NULL);
    762         center_string(blurb, 80);
     745        /* BERLIOS: center_string is now broken replace it ! */
     746        //center_string(blurb, 80);
    763747        newtPushHelpLine(blurb);
     748        paranoid_free(blurb);
    764749        b_res = newtRunForm(myForm);
    765750        strcpy(output, entry_value);
     
    769754        if (b_res == b_2) {
    770755            strcpy(output, original_contents);
    771             paranoid_free(blurb);
    772756            paranoid_free(original_contents);
    773757            return (FALSE);
    774758        } else {
    775             paranoid_free(blurb);
    776759            paranoid_free(original_contents);
    777760            return (TRUE);
     
    790773
    791774        /*@ buffers *********************************************************** */
    792         char *prompt, *tmp;
     775        char *prompt;
     776        char *tmp = NULL;
     777        size_t n = 0;
    793778
    794779        /*@ newt ************************************************************** */
     
    799784        newtComponent text;
    800785
    801         prompt = malloc(MAX_NEWT_COMMENT_LEN);
    802         tmp = malloc(MAX_NEWT_COMMENT_LEN);
    803786        assert_string_is_neither_NULL_nor_zerolength(p);
    804787        assert(button1 != NULL);
     
    810793                printf("%s (%s or %s) --> ", p, button1, button2);
    811794            }
    812             for (tmp[0] = '\0';
     795            for (asprintf(&tmp,"");
    813796                 strcmp(tmp, button1) && (strlen(button2) == 0
    814797                                          || strcmp(tmp, button2));) {
    815798                printf("--> ");
    816                 (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     799                paranoid_free(tmp);
     800                (void) getline(&tmp, &n, stdin);
    817801            }
    818802            if (!strcmp(tmp, button1)) {
    819803                paranoid_free(tmp);
    820                 paranoid_free(prompt);
    821804                return (TRUE);
    822805            } else {
    823806                paranoid_free(tmp);
    824                 paranoid_free(prompt);
    825807                return (FALSE);
    826808            }
    827809        }
    828810
    829         strcpy(prompt, p);
     811        asprintf(&prompt, p);
    830812        text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0);
    831813        b_1 =
     
    845827        myForm = newtForm(NULL, NULL, 0);
    846828        newtFormAddComponents(myForm, text, b_1, b_2, NULL);
    847         center_string(prompt, 80);
     829        /* BERLIOS: center_string is now broken replace it ! */
     830        //center_string(prompt, 80);
    848831        newtPushHelpLine(prompt);
     832        paranoid_free(prompt);
    849833        b_res = newtRunForm(myForm);
    850834        newtPopHelpLine();
     
    852836        newtPopWindow();
    853837        if (b_res == b_1) {
    854             paranoid_free(tmp);
    855             paranoid_free(prompt);
    856838            return (TRUE);
    857839        } else {
    858             paranoid_free(tmp);
    859             paranoid_free(prompt);
    860840            return (FALSE);
    861841        }
     
    936916
    937917/**
    938  * Update the evalcall form to show (<tt>num</tt>/<tt>denom</tt>)*100 %.
     918 * Update the evalcall form to show <tt>num</tt> %.
    939919 * @param num The numerator of the ratio.
    940  * @param denom The denomenator of the ratio.
    941920 */
    942921    void
    943      update_evalcall_form_ratio(int num, int denom) {
     922     update_evalcall_form(int num) {
    944923
    945924        /*@ long ************************************************************ */
     
    953932        char *pcline_str;
    954933        char *taskprogress;
     934        char *tmp1;
     935        char *tmp2;
     936        char *p;
    955937
    956938        /*@ int ************************************************************** */
     
    959941        int j = 0;
    960942
    961         malloc_string(timeline_str);
    962         malloc_string(pcline_str);
    963         malloc_string(taskprogress);
    964         timeline_str[0] = '\0';
    965 //  log_it("update_eval_call_form called");
    966         if (num * 100 < denom) {
     943        //log_it("update_eval_call_form called");
     944        if (num < 1) {
    967945            percentage = 1;
    968946        } else {
    969             percentage = (num * 100 + denom / 2) / denom;
     947            percentage = (int)trunc(num) ;
    970948        }
    971949
     
    973951        time_taken = current_time - g_isoform_starttime;
    974952        if (num) {
    975             time_total_est = time_taken * denom / num;
     953            time_total_est = time_taken * 100 / num;
    976954            time_remaining = time_total_est - time_taken;
    977955        } else {
     
    981959            newtLabelSetText(g_isoform_header, g_isoform_header_str);
    982960        }
     961        /* BERLIOS: 27 should be a parameter */
    983962        g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
    984963        if ((percentage < 3 && g_isoform_old_progress < 3)
    985964            || percentage > g_isoform_old_progress) {
    986965            g_isoform_old_progress = percentage;
    987             sprintf(timeline_str,
     966            asprintf(&timeline_str,
    988967                    "%2ld:%02ld taken            %2ld:%02ld remaining",
    989968                    time_taken / 60, time_taken % 60, time_remaining / 60,
    990969                    time_remaining % 60);
    991970            if (percentage < 3) {
    992                 sprintf(pcline_str, " Working");
    993                 for (j = 0; j < g_mysterious_dot_counter; j++) {
    994                     strcat(pcline_str, ".");
     971                tmp1 = (char *)malloc(g_mysterious_dot_counter * sizeof(char));
     972                for (i = 0, p = tmp1 ; i < g_mysterious_dot_counter - 1 ; i++, p++) {
     973                        *p = '.';
    995974                }
    996                 for (; j < 27; j++) {
    997                     strcat(pcline_str, " ");
     975                *p = '\0';
     976
     977                /* BERLIOS: 27 should be a parameter */
     978                tmp2 = (char *)malloc(27-g_mysterious_dot_counter * sizeof(char));
     979                for (i = 0, p = tmp2 ; i < 27 - g_mysterious_dot_counter - 1 ; i++, p++) {
     980                        *p = ' ';
    998981                }
    999                 sprintf(pcline_str + strlen(pcline_str), " %c",
    1000                         special_dot_char(g_mysterious_dot_counter));
     982                *p = '\0';
     983
     984                asprintf(&pcline_str, " Working%s%s %c", tmp1, tmp2, special_dot_char(g_mysterious_dot_counter));
     985                paranoid_free(tmp1);
     986                paranoid_free(tmp2);
    1001987            } else {
    1002                 sprintf(pcline_str, " %3d%% done              %3d%% to go",
     988                asprintf(&pcline_str, " %3d%% done              %3d%% to go",
    1003989                        percentage, 100 - percentage);
    1004990            }
    1005991            if (g_text_mode) {
    1006                 sprintf(taskprogress, "TASK:  [");
    1007                 for (i = 0; i < percentage; i += 5) {
    1008                     strcat(taskprogress, "*");
     992                j = trunc(percentage/5);
     993                tmp1 = (char *)malloc((j + 1) * sizeof(char));
     994                for (i = 0, p = tmp1 ; i < j ; i++, p++) {
     995                        *p = '*';
    1009996                }
    1010                 for (; i < 100; i += 5) {
    1011                     strcat(taskprogress, ".");
     997                *p = '\0';
     998
     999                tmp2 = (char *)malloc((20 - j + 1) * sizeof(char));
     1000                for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) {
     1001                        *p = '.';
    10121002                }
     1003                *p = '\0';
     1004
    10131005                if (percentage >= 3) {
    1014                     sprintf(taskprogress + strlen(taskprogress),
    1015                             "] %3d%% done; %2ld:%02ld to go", percentage,
    1016                             time_remaining / 60, time_remaining % 60);
     1006                    asprintf(&taskprogress, "TASK:  [%s%s] %3d%% done; %2ld:%02ld to go", tmp1, tmp2, percentage, time_remaining / 60, time_remaining % 60);
    10171007                    printf("---evalcall---1--- %s\r\n",
    10181008                           g_isoform_header_str);
    10191009                    printf("---evalcall---2--- %s\r\n", taskprogress);
    10201010                    printf("---evalcall---E---\r\n");
     1011                    paranoid_free(taskprogress);
    10211012                }
    10221013            } else {
     
    10281019                }
    10291020            }
     1021            paranoid_free(timeline_str);
     1022            paranoid_free(pcline_str);
    10301023        }
    10311024        if (!g_text_mode) {
     
    10331026            newtRefresh();
    10341027        }
    1035         paranoid_free(timeline_str);
    1036         paranoid_free(pcline_str);
    1037         paranoid_free(taskprogress);
    1038     }
    1039 
    1040 
    1041 
    1042 /**
    1043  * Update the evalcall form to show @p curr %.
    1044  * @param curr The current amount of progress (percentage) in the evalcall form.
    1045  */
    1046     void
    1047      update_evalcall_form(int curr) {
    1048         update_evalcall_form_ratio(curr, 100);
    1049     }
    1050 
     1028    }
    10511029
    10521030
     
    10631041            return;
    10641042        }
    1065         strcpy(g_blurb_str_2, blurb3);
     1043        paranoid_free(g_blurb_str_2);
     1044        asprintf(&g_blurb_str_2, blurb3);
    10661045        update_progress_form_full(g_blurb_str_1, g_blurb_str_2,
    10671046                                  g_blurb_str_3);
     
    10861065        int percentage = 0;
    10871066        int i = 0;
     1067        int j = 0;
    10881068
    10891069        /*@ buffers *************************************************** */
     
    10921072        char *taskprogress;
    10931073        char *tmp;
     1074        char *tmp1;
     1075        char *tmp2;
     1076        char *p;
    10941077
    10951078//  log_msg(1, "'%s' '%s' '%s'", blurb1, blurb2, blurb3);
    1096         percentline_str = malloc(MAX_NEWT_COMMENT_LEN);
    1097         timeline_str = malloc(MAX_NEWT_COMMENT_LEN);
    1098         taskprogress = malloc(MAX_NEWT_COMMENT_LEN);
    1099         malloc_string(tmp);
    11001079        if (!g_text_mode) {
    11011080            assert(blurb1 != NULL);
     
    11051084        }
    11061085
    1107         percentline_str[0] = '\0';
    1108 
    11091086        current_time = get_time();
    11101087        time_taken = current_time - g_start_time;
     
    11131090        } else {
    11141091            if (g_current_progress > g_maximum_progress) {
    1115                 sprintf(tmp,
     1092                asprintf(&tmp,
    11161093                        "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld",
    11171094                        blurb1, blurb2, blurb3, g_current_progress,
    11181095                        g_maximum_progress);
    11191096                log_msg(0, tmp);
     1097                paranoid_free(tmp);
    11201098                g_current_progress = g_maximum_progress;
    11211099            }
     
    11371115            time_remaining = 0;
    11381116        }
    1139         g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
    1140         sprintf(timeline_str,
     1117        /* BERLIOS/ Is it useful here ? */
     1118        //g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
     1119        asprintf(&timeline_str,
    11411120                "%2ld:%02ld taken               %2ld:%02ld remaining  ",
    11421121                time_taken / 60, time_taken % 60, time_remaining / 60,
    11431122                time_remaining % 60);
    1144         sprintf(percentline_str, " %3d%% done                 %3d%% to go",
     1123        asprintf(&percentline_str, " %3d%% done                 %3d%% to go",
    11451124                percentage, 100 - percentage);
    11461125
     
    11501129            printf("---progress-form---3--- %s\r\n", blurb3);
    11511130            printf("---progress-form---E---\n");
    1152             sprintf(taskprogress, "TASK:  [");
    1153             for (i = 0; i < percentage; i += 5) {
    1154                 strcat(taskprogress, "*");
    1155             }
    1156             for (; i < 100; i += 5) {
    1157                 strcat(taskprogress, ".");
    1158             }
     1131
     1132            j = trunc(percentage/5);
     1133            tmp1 = (char *)malloc((j + 1) * sizeof(char));
     1134            for (i = 0, p = tmp1 ; i < j ; i++, p++) {
     1135                    *p = '*';
     1136            }
     1137            *p = '\0';
     1138
     1139            tmp2 = (char *)malloc((20 - j + 1) * sizeof(char));
     1140            for (i = 0, p = tmp2 ; i <  20 - j ; i++, p++) {
     1141                    *p = '.';
     1142            }
     1143            *p = '\0';
     1144
    11591145            if (percentage > 100) {
    11601146                log_msg(2, "percentage = %d", percentage);
    11611147            }
    1162             sprintf(taskprogress + strlen(taskprogress),
    1163                     "] %3d%c", percentage, '%');
    1164             sprintf(taskprogress + strlen(taskprogress),
    1165                     " done; %2ld:%02ld to go",
    1166                     time_remaining / 60, time_remaining % 60);
     1148            asprintf(&taskprogress, "TASK:  [%s%s] %3d%% done; %2ld:%02ld to go", tmp1, tmp2, percentage, time_remaining / 60, time_remaining % 60);
     1149
    11671150            printf("---progress-form---4--- %s\r\n", taskprogress);
    1168         } else {
    1169             center_string(blurb1, 54);
    1170             center_string(blurb2, 54);
    1171             center_string(blurb3, 54);
     1151            paranoid_free(taskprogress);
     1152        } else {
     1153            /* BERLIOS: center_string is now broken replace it ! */
     1154            //center_string(blurb1, 54);
     1155            /* BERLIOS: center_string is now broken replace it ! */
     1156            //center_string(blurb2, 54);
     1157            /* BERLIOS: center_string is now broken replace it ! */
     1158            //center_string(blurb3, 54);
    11721159            newtLabelSetText(g_blurb1, blurb1);
    11731160            newtLabelSetText(g_blurb2, blurb3);
     
    11821169        paranoid_free(percentline_str);
    11831170        paranoid_free(timeline_str);
    1184         paranoid_free(taskprogress);
    1185         paranoid_free(tmp);
    1186     }
    1187 
    1188 
    1189 
    1190 
    1191 
    1192 
    1193 
    1194 
    1195 
    1196 
    1197 
    1198 
     1171    }
    11991172
    12001173
     
    12221195            "nfs", "iso", NULL
    12231196        };
    1224         char *outstr;
     1197        char *outstr = NULL;
    12251198        t_bkptype backup_type;
    12261199        int i;
     1200        size_t n = 0;
    12271201
    12281202        newtComponent b1;
     
    12371211        newtComponent myForm;
    12381212
    1239         title_sz = malloc(MAX_NEWT_COMMENT_LEN);
    1240         minimsg_sz = malloc(MAX_NEWT_COMMENT_LEN);
    1241         outstr = malloc(MAX_NEWT_COMMENT_LEN);
    12421213        if (g_text_mode) {
    12431214            for (backup_type = none; backup_type == none;) {
     
    12481219                }
    12491220                printf(")\n--> ");
    1250                 (void) fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin);
     1221                (void) getline(&outstr, &n, stdin);
    12511222                strip_spaces(outstr);
    12521223                for (i = 0; possible_responses[i]; i++) {
     
    12561227                }
    12571228            }
    1258             paranoid_free(title_sz);
    1259             paranoid_free(minimsg_sz);
    12601229            paranoid_free(outstr);
    12611230            return (backup_type);
     
    12631232        newtDrawRootText(18, 0, WELCOME_STRING);
    12641233        if (restoring) {
    1265             strcpy(title_sz,
     1234            asprintf(&title_sz,
    12661235                   "Please choose the backup media from which you want to read data.");
    1267             strcpy(minimsg_sz, "Read from:");
    1268         } else {
    1269             strcpy(title_sz,
     1236            asprintf(&minimsg_sz, "Read from:");
     1237        } else {
     1238            asprintf(&title_sz,
    12701239                   "Please choose the backup media to which you want to archive data.");
    1271             strcpy(minimsg_sz, "Backup to:");
     1240            asprintf(&minimsg_sz, "Backup to:");
    12721241        }
    12731242        newtPushHelpLine(title_sz);
     1243        paranoid_free(title_sz);
     1244
    12741245        //  newtOpenWindow (23, 3, 34, 17, minimsg_sz);
    12751246        newtCenteredWindow(34, 17, minimsg_sz);
     1247        paranoid_free(minimsg_sz);
     1248
    12761249        b1 = newtButton(1, 1, "CD-R disks ");
    12771250        b2 = newtButton(17, 1, "CD-RW disks");
     
    13061279        }
    13071280        newtPopHelpLine();
    1308         paranoid_free(title_sz);
    1309         paranoid_free(minimsg_sz);
    1310         paranoid_free(outstr);
    13111281        return (output);
    13121282    }
    1313 
    1314 
    13151283
    13161284
     
    13681336
    13691337
    1370 
    1371 
    1372 
    13731338/**
    13741339 * Load @p source_file (a list of files) into @p filelist. There can be no more than
     
    13811346        int i;
    13821347        bool done;
    1383         char *tmp;
     1348        char *reason = NULL;
     1349        char *tmp = NULL;
     1350        size_t n = 0;
    13841351        FILE *fin;
    13851352        struct s_filelist_entry dummy_fle;
    13861353
    1387         malloc_string(tmp);
    13881354        assert(filelist != NULL);
    13891355        assert_string_is_neither_NULL_nor_zerolength(source_file);
     
    13941360            log_msg(2, "Can't open %s; therefore, cannot popup list",
    13951361                    source_file);
    1396             paranoid_free(tmp);
    13971362            return (1);
    13981363        }
     
    14041369                break;
    14051370            }
    1406             (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, fin);
     1371            (void) getline(&tmp, &n, fin);
    14071372            i = (int) strlen(tmp);
    14081373            if (i < 2) {
     
    14191384            }
    14201385            filelist->el[filelist->entries].severity =
    1421                 severity_of_difference(tmp, NULL);
     1386                severity_of_difference(tmp, reason);
     1387            paranoid_free(reason);
    14221388            strcpy(filelist->el[filelist->entries].filename, tmp);
    14231389            if (feof(fin)) {
     
    14311397            return (1);
    14321398        }
     1399        paranoid_free(tmp);
     1400
    14331401        for (done = FALSE; !done;) {
    14341402            done = TRUE;
     
    14561424            }
    14571425        }
    1458         paranoid_free(tmp);
    14591426        iamhere("leaving");
    14601427        return (0);
     
    14701437 */
    14711438    char *filelist_entry_to_string(struct s_filelist_entry *flentry) {
    1472         static char comment[100];
    1473         char *tmp;
     1439        char *comment;
    14741440
    14751441        iamhere("entering");
    1476         malloc_string(tmp);
    14771442        assert(flentry != NULL);
    14781443        if (flentry->severity == 0) {
    1479             strcpy(tmp, "0   ");
     1444            asprintf(&comment, "0     %93s", flentry->filename);
    14801445        } else if (flentry->severity == 1) {
    1481             strcpy(tmp, "low ");
     1446            asprintf(&comment, "low   %93s", flentry->filename);
    14821447        } else if (flentry->severity == 2) {
    1483             strcpy(tmp, "med ");
    1484         } else {
    1485             strcpy(tmp, "high");
    1486         }
    1487         strcat(tmp, "  ");
    1488         strncat(tmp, flentry->filename, 100);
    1489         tmp[98] = '\0';
    1490         strcpy(comment, tmp);
    1491         paranoid_free(tmp);
     1448            asprintf(&comment, "med   %93s", flentry->filename);
     1449        } else {
     1450            asprintf(&comment, "high  %93s", flentry->filename);
     1451        }
    14921452        iamhere("leaving");
    14931453        return (comment);
     
    15041464 */
    15051465    void popup_changelist_from_file(char *source_file) {
    1506         char *reason;
     1466        char *reason = NULL;
    15071467        newtComponent myForm;
    15081468        newtComponent bClose;
     
    15271487
    15281488        struct s_filelist *filelist;
    1529         malloc_string(reason);
    1530         tmp = malloc(5000);
    1531         malloc_string(differ_sz);
    15321489        assert_string_is_neither_NULL_nor_zerolength(source_file);
    15331490        if (g_text_mode) {
    15341491            log_msg(2, "Text mode. Therefore, no popup list.");
    1535             goto free_to_go;
     1492            return;
    15361493        }
    15371494        log_msg(2, "Examining file %s", source_file);
     
    15401497        if (lng < 1) {
    15411498            log_msg(2, "No lines in file. Therefore, no popup list.");
    1542             paranoid_free(reason);
    1543             goto free_to_go;
     1499            return;
    15441500        } else if (lng >= ARBITRARY_MAXIMUM) {
    15451501            log_msg(2, "Too many files differ for me to list.");
    1546             goto free_to_go;
     1502            return;
    15471503        }
    15481504
     
    15551511            log_msg(2, "Can't open %s; therefore, cannot popup list",
    15561512                    source_file);
    1557             paranoid_free(reason);
    15581513            return;
    15591514        }
     
    15681523                                   keylist[i]);
    15691524        }
    1570         sprintf(differ_sz,
     1525        asprintf(&differ_sz,
    15711526                "  %d files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.",
    15721527                i);
    15731528        newtPushHelpLine(differ_sz);
     1529        paranoid_free(differ_sz);
     1530
    15741531        bClose = newtCompactButton(10, 15, " Close  ");
    15751532        bSelect = newtCompactButton(30, 15, " Select ");
    1576         sprintf(tmp, "%-10s               %-20s", "Priority", "Filename");
     1533        asprintf(&tmp, "%-10s               %-20s", "Priority", "Filename");
    15771534        headerMsg = newtLabel(2, 1, tmp);
     1535        paranoid_free(tmp);
     1536
    15781537        newtOpenWindow(5, 4, 70, 16, "Non-matching files");
    15791538        myForm = newtForm(NULL, NULL, 0);
     
    15961555                        severity_of_difference(filelist->el[currline].
    15971556                                               filename, reason);
    1598                         sprintf(tmp, "%s --- %s",
     1557                        asprintf(&tmp, "%s --- %s",
    15991558                                filelist->el[currline].filename, reason);
    16001559                        popup_and_OK(tmp);
     1560                        paranoid_free(tmp);
     1561                        paranoid_free(reason);
    16011562                    }
    16021563                }
     
    16061567        newtPopWindow();
    16071568        newtPopHelpLine();
    1608       free_to_go:
    1609         paranoid_free(reason);
    1610         paranoid_free(tmp);
    1611         paranoid_free(differ_sz);
    1612         return;
    16131569    }
    16141570
  • trunk/mondo/mondo/mondoarchive/main.c

    r59 r87  
    319319    welcome_to_mondoarchive();
    320320    distro_specific_kludges_at_start_of_mondoarchive();
    321     sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir,
    322             bkpinfo->scratchdir);
     321    // BERLIOS : too early, bkpinfo is not initialized ??
     322    //sprintf(g_erase_tmpdir_and_scratchdir, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
    323323    g_kernel_version = get_kernel_version();
    324324
  • trunk/mondo/mondo/mondoarchive/mondo-cli.c

    r59 r87  
    161161/** @def BOOT_LOADER_CHARS The characters allowed for boot loader on this platform. */
    162162
    163 #include <pthread.h>
    164163#include "../common/my-stuff.h"
    165164#include "../common/mondostructures.h"
    166165#include "mondo-cli-EXT.h"
    167166#include "../common/libmondo.h"
    168 
    169 
     167#include <pthread.h>
    170168
    171169#ifndef VERSION
    172170#define VERSION AUX_VER
    173171#endif
    174 
    175172
    176173
     
    263260        retrieve_switches_from_command_line(argc, argv, flag_val,
    264261                                            flag_set);
     262    log_it("value: %s", flag_val['s']);
    265263    retval += res;
    266264    if (!retval) {
  • trunk/mondo/mondo/mondorestore/mondo-restore.c

    r59 r87  
    381381 * #include statements                                                    *
    382382 **************************************************************************/
    383 #include <pthread.h>
    384383#include "../common/my-stuff.h"
    385384#include "../common/mondostructures.h"
     
    389388#include "mondo-rstr-compare-EXT.h"
    390389#include "mondo-rstr-tools-EXT.h"
     390#include <pthread.h>
    391391
    392392extern void success_message(void);
  • trunk/mondo/mondo/mondorestore/mondo-rstr-compare.c

    r59 r87  
    5555
    5656
    57 #include <pthread.h>
    5857#include "../common/my-stuff.h"
    5958#include "../common/mondostructures.h"
     
    6463#include "mondo-restore-EXT.h"
    6564#include "mondo-rstr-tools-EXT.h"
     65#include <pthread.h>
    6666
    6767//static char cvsid[] = "$Id$";
  • trunk/mondo/mondo/mondorestore/mondo-rstr-tools.c

    r59 r87  
    124124
    125125
    126 #include <pthread.h>
    127126#include "../common/my-stuff.h"
    128127#include "../common/mondostructures.h"
     
    132131//#include "mondo-rstr-compare-EXT.h"
    133132#include "mondo-rstr-tools.h"
     133#include <pthread.h>
    134134
    135135extern bool g_sigpipe_caught;
Note: See TracChangeset for help on using the changeset viewer.