Ignore:
Timestamp:
Mar 24, 2007, 1:48:55 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • mr_exit used instead of exit
  • mr_rs_clean_conf/mr_rs_cleanup/mr_ar_clean_conf/mr_ar_cleanup added
  • compiltaion warnings suppressed
  • Addition of mr_types (for boolean with typedef)
  • struct mr_rs_conf added
  • help_screen removed (useless)
File:
1 edited

Legend:

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

    r1251 r1264  
    1919#include "mr_msg.h"
    2020#include "mr_str.h"
     21#include "mr_err.h"
    2122
    2223#include "mondostructures.h"
     
    129130extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived,
    130131                                 char direction);
     132
     133struct mr_rs_conf mr_conf;
     134
     135/* destroy the mr_rs_conf structure's content */
     136static void mr_rs_clean_conf(struct mr_rs_conf *mr_cnf) {
     137   
     138    if (mr_cnf == NULL) {
     139        return;
     140    }
     141    mr_free(&mr_cnf->media_device);
     142    mr_free(&mr_cnf->prefix);
     143    mr_free(&mr_cnf->boot_loader);
     144    mr_free(&mr_cnf->compression_tool);
     145    mr_free(&mr_cnf->ui_mode);
     146    mr_free(&mr_cnf->images_dir);
     147}
     148
     149/* Create the pointer to the function called in mr_exit */
     150void (*mr_cleanup)(void) = NULL;
     151
     152/* Cleanup all memory allocated in various structures */
     153void mr_rs_cleanup(void) {
     154    /* Highly incomplete function for the moment */
     155    /* We have to free all allocated memory */
     156        /* Not allocated yet
     157    mr_rs_clean_conf(&mr_conf);
     158    */
     159    /* We have to remove all temporary files */
     160    /* We have to unmount what has been mounted */
     161    /* We have to properly end newt */
     162    /* We have to remind people of log files */
     163
     164    mr_msg_close();
     165}
    131166
    132167/**************************************************************************
     
    954989    int res = 0;
    955990    int old_loglevel;
    956     char *sz_msg = NULL;
    957991    struct s_node *node = NULL;
    958992
     
    17101744
    17111745  /** malloc add ***/
    1712     char *tmp = NULL;
    17131746    char *command = NULL;
    17141747    char *afio_fname = NULL;
     
    27542787#endif
    27552788
     2789    /* Reference the right cleanup function for mr_exit */
     2790    mr_cleanup = mr_rs_cleanup;
     2791
    27562792    if (getuid() != 0) {
    27572793        fprintf(stderr, _("Please run as root.\n"));
    2758         exit(127);
     2794        mr_exit(127, NULL);
    27592795    }
    27602796
     
    32053241    unlink("/tmp/filelist.full.gz");
    32063242
    3207     exit(retval);
     3243    mr_exit(retval, NULL);
    32083244}
    32093245
Note: See TracChangeset for help on using the changeset viewer.