Changeset 1264 in MondoRescue for branches/stable/mondo/src/mondorestore/mondorestore.c
- Timestamp:
- Mar 24, 2007, 1:48:55 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondorestore/mondorestore.c
r1251 r1264 19 19 #include "mr_msg.h" 20 20 #include "mr_str.h" 21 #include "mr_err.h" 21 22 22 23 #include "mondostructures.h" … … 129 130 extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, 130 131 char direction); 132 133 struct mr_rs_conf mr_conf; 134 135 /* destroy the mr_rs_conf structure's content */ 136 static 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 */ 150 void (*mr_cleanup)(void) = NULL; 151 152 /* Cleanup all memory allocated in various structures */ 153 void 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 } 131 166 132 167 /************************************************************************** … … 954 989 int res = 0; 955 990 int old_loglevel; 956 char *sz_msg = NULL;957 991 struct s_node *node = NULL; 958 992 … … 1710 1744 1711 1745 /** malloc add ***/ 1712 char *tmp = NULL;1713 1746 char *command = NULL; 1714 1747 char *afio_fname = NULL; … … 2754 2787 #endif 2755 2788 2789 /* Reference the right cleanup function for mr_exit */ 2790 mr_cleanup = mr_rs_cleanup; 2791 2756 2792 if (getuid() != 0) { 2757 2793 fprintf(stderr, _("Please run as root.\n")); 2758 exit(127);2794 mr_exit(127, NULL); 2759 2795 } 2760 2796 … … 3205 3241 unlink("/tmp/filelist.full.gz"); 3206 3242 3207 exit(retval);3243 mr_exit(retval, NULL); 3208 3244 } 3209 3245
Note:
See TracChangeset
for help on using the changeset viewer.