Ignore:
Timestamp:
Jun 3, 2009, 7:10:19 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3089@localhost: bruno | 2009-05-18 06:41:05 +0200

  • move call to asprintf to call to mr_asprintf (suppress a compiler warning)
  • remove all the most obvious bad call to strcat and replace by mr_strcat as appropriate
File:
1 edited

Legend:

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

    r2113 r2211  
    11/***************************************************************************
    2                           main.c  -  description
    3                              -------------------
    4     begin                : Fri Apr 19 16:40:35 EDT 2002
    5     copyright            : (C) 2002 by Stan Benoit
    6     email                : troff@nakedsoul.org
    7     cvsid                : $Id$
    8  ***************************************************************************/
    9 
    10 /***************************************************************************
    11  *                                                                         *
    12  *   This program is free software; you can redistribute it and/or modify  *
    13  *   it under the terms of the GNU General Public License as published by  *
    14  *   the Free Software Foundation; either version 2 of the License, or     *
    15  *   (at your option) any later version.                                   *
    16  *                                                                         *
    17  ***************************************************************************/
    18 
    19 /**
    20  * @file
    21  * The main file for mondoarchive.
    22  */
     2$Id$
     3* The main file for mondoarchive.
     4*/
    235
    246/************************* #include statements *************************/
     
    279#include <stdlib.h>
    2810#include "my-stuff.h"
     11#include "mr_mem.h"
    2912#include "../common/mondostructures.h"
    3013#include "../common/libmondo.h"
     
    7053/* Reference to global bkpinfo */
    7154struct s_bkpinfo *bkpinfo;
     55
     56/* No cleanup for the moment */
     57void (*mr_cleanup)(void) = NULL;
    7258
    7359/* To be coded */
     
    183169    char *tmp1 = NULL;
    184170    int res, retval;
    185     char *say_at_end;
     171    char *say_at_end = NULL;
    186172
    187173/* Make sure I'm root; abort if not */
     
    211197    diffs = 0;
    212198    malloc_string(tmp);
    213     malloc_string(say_at_end);
    214     say_at_end[0] = '\0';
    215199    malloc_libmondo_global_strings();
    216200
     
    220204
    221205    /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
    222     asprintf(&tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
     206    mr_asprintf(&tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
    223207    setenv("PATH", tmp1, 1);
    224208    paranoid_free(tmp1);
    225209
    226210    /* Add the ARCH environment variable for ia64 purposes */
    227     asprintf(&tmp1,"%s",get_architecture());
     211    mr_asprintf(&tmp1,"%s",get_architecture());
    228212    setenv("ARCH", tmp1, 1);
    229213    paranoid_free(tmp1);
     
    378362        retval += res;
    379363        if (res) {
    380             strcat(say_at_end,
     364            mr_asprintf(&say_at_end,
    381365                   "Data archived. Please check the logs, just as a precaution. ");
    382366        } else {
    383             strcat(say_at_end, "Data archived OK. ");
     367            mr_asprintf(&say_at_end, "Data archived OK. ");
    384368        }
    385369    }
     
    391375            sprintf(tmp, "%d difference%c found.", -res,
    392376                    (-res != 1) ? 's' : ' ');
    393             strcat(say_at_end, tmp);
     377            mr_asprintf(&say_at_end, tmp);
    394378            log_to_screen(tmp);
    395379            res = 0;
     
    424408        unlink(MONDO_CACHE"/changed.files");
    425409    }
    426     log_to_screen(say_at_end);
     410    if (say_at_end != NULL) {
     411        log_to_screen(say_at_end);
     412        paranoid_free(say_at_end);
     413    }
    427414    sprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
    428415    run_program_and_log_output(tmp, TRUE);
     
    445432
    446433    free_libmondo_global_strings();
    447     paranoid_free(say_at_end);
    448434   
    449435
Note: See TracChangeset for help on using the changeset viewer.