Changeset 2340 in MondoRescue for branches/2.2.10/mondo/src
- Timestamp:
- Aug 21, 2009, 1:53:49 AM (16 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2331 r2340 211 211 char *outfname = NULL; 212 212 char *biggie_fname = NULL; 213 char *incoming ;213 char *incoming = NULL; 214 214 char *tmp = NULL; 215 215 … … 257 257 return (curr_set_no + 1); 258 258 } 259 incoming = malloc(MAX_STR_LEN * 2); 260 261 (void) fgets(incoming, MAX_STR_LEN * 2 - 1, fin); 259 260 mr_getline(incoming, fin); 262 261 while (!feof(fin)) { 263 262 lino++; … … 266 265 i = 0; 267 266 } 267 /* Now that we dyn. alloc is truncating needed ? 268 268 if (i > MAX_STR_LEN - 1) { 269 269 incoming[MAX_STR_LEN - 30] = '\0'; … … 271 271 err++; 272 272 } 273 */ 273 274 if (incoming[i] < 32) { 274 275 incoming[i] = '\0'; … … 299 300 mr_free(outfname); 300 301 mr_free(biggie_fname); 301 paranoid_free(incoming);302 mr_free(incoming); 302 303 return (curr_set_no + 1); 303 304 } … … 305 306 } 306 307 } 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 310 313 paranoid_fclose(fin); 311 314 paranoid_fclose(fout); … … 1332 1335 * @bug Return value should be @c void. 1333 1336 */ 1334 int open_and_list_dir(char *dir1, char *sth, FILE * fout, 1335 time_t time_of_last_full_backup) 1336 { 1337 int open_and_list_dir(char *dir1, char *sth, FILE * fout, time_t time_of_last_full_backup) { 1338 1337 1339 const char delims[] = " "; 1338 1340 … … 1341 1343 struct stat statbuf; 1342 1344 char *new; 1343 char *tmp ;1345 char *tmp = NULL; 1344 1346 char *dir = NULL; 1345 1347 static int percentage = 0; 1346 char *skip_these ;1347 char *new_with_spaces ;1348 char *skip_these = NULL; 1349 char *new_with_spaces = NULL; 1348 1350 char *strtmp; 1349 1351 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; 1352 1355 int i; 1353 1356 int lastpos = 0; … … 1356 1359 static int counter = 0; 1357 1360 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; 1361 1363 time_t this_time; 1362 1364 … … 1371 1373 1372 1374 if (!depth) { 1373 malloc_string(name_of_evalcall_form);1374 malloc_string(find_skeleton_marker);1375 1375 mr_asprintf(find_excludes, " "); 1376 1376 if (sth != NULL) { … … 1397 1397 mr_free(tmp); 1398 1398 1399 sprintf(name_of_evalcall_form, "Making catalog of %s", dir);1399 mr_asprintf(name_of_evalcall_form, "Making catalog of %s", dir); 1400 1400 open_evalcall_form(name_of_evalcall_form); 1401 find_skeleton_marker[0] = '\0'; 1401 mr_free(name_of_evalcall_form); 1402 1402 1403 skeleton_lino = 1; 1403 1404 log_msg(5, "entries = %ld", g_skeleton_entries); … … 1405 1406 } else // update evalcall form if appropriate 1406 1407 { 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); 1410 1409 if (!system(find_skeleton_marker)) { 1411 1410 percentage = (int) (skeleton_lino * 100 / g_skeleton_entries); 1412 1411 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); 1416 1416 time(&this_time); 1417 1417 if (this_time != last_time) { … … 1427 1427 } 1428 1428 } 1429 mr_free(find_skeleton_marker); 1429 1430 } 1430 1431 … … 1453 1454 mr_asprintf(new,"%s%s",dir,dit->d_name); 1454 1455 } 1455 paranoid_free(new_with_spaces);1456 mr_free(new_with_spaces); 1456 1457 mr_asprintf(new_with_spaces, " %s ", new); 1457 1458 if (strstr(skip_these, new_with_spaces)) { … … 1463 1464 if (!S_ISLNK(statbuf.st_mode) 1464 1465 && 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); 1467 1467 } 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) { 1471 1469 fprintf(fout, "%s\n", new); 1472 1470 if ((counter++) > 128) { 1473 1471 counter = 0; 1474 1472 uberctr++; 1473 #ifndef _XWIN 1475 1474 mr_asprintf(tmp, " %c ", special_dot_char(uberctr)); 1476 #ifndef _XWIN1477 1475 if (!g_text_mode) { 1478 1476 newtDrawRootText(77, g_noof_rows - 3, tmp); 1479 1477 newtRefresh(); 1480 1478 } 1479 mr_free(tmp); 1481 1480 #endif 1482 mr_free(tmp);1483 1481 } 1484 1482 } … … 1486 1484 } 1487 1485 } 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); 1493 1491 mr_free(dir); 1494 1492 … … 1501 1499 if (!depth) { 1502 1500 close_evalcall_form(); 1503 paranoid_free(name_of_evalcall_form);1504 paranoid_free(find_skeleton_marker);1505 1501 unlink(g_skeleton_filelist); 1506 1502 log_msg(5, "g_skeleton_entries = %ld", g_skeleton_entries); … … 1596 1592 ("date +%s")); 1597 1593 } 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."); 1600 1595 differential = 0; 1601 1596 time_of_last_full_backup = 0; … … 1608 1603 // use user-specified filelist (if specified) 1609 1604 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); 1613 1606 mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist); 1614 1607 if (run_program_and_log_output(command, 3)) { -
branches/2.2.10/mondo/src/common/newt-specific.c
r2334 r2340 378 378 * @note This function never returns. 379 379 */ 380 void 381 finish(int signal) { 380 void finish(int signal) { 381 382 382 char *command = NULL; 383 383 … … 393 393 mr_free(command); 394 394 } 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);401 395 if (bkpinfo->tmpdir) { 402 396 log_msg(8,"tempdir is %s",bkpinfo->tmpdir); … … 421 415 free_libmondo_global_strings(); 422 416 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); 423 423 exit(signal); 424 424 } 425 426 427 428 425 429 426 … … 998 995 mr_free(taskprogress); 999 996 } else { 1000 newtScaleSet(g_isoform_scale, 1001 (unsigned long long) percentage); 997 newtScaleSet(g_isoform_scale, (unsigned long long) percentage); 1002 998 if (g_isoform_pcline) { 1003 999 newtLabelSetText(g_isoform_pcline, pcline_str); -
branches/2.2.10/mondo/src/include/my-stuff.h
r2334 r2340 8 8 // Extra info for ACLs and SELINUX users 9 9 #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 user13 10 14 11 /** -
branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c
r2325 r2340 36 36 extern t_bkptype g_backup_media_type; 37 37 extern int g_loglevel; 38 extern char *g_magicdev_command; 38 39 39 40 /** … … 71 72 char *tmp = NULL; 72 73 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); 75 75 log_msg(0, "running %s binaries", get_architecture()); 76 76 tmp = get_uname_m(); 77 77 log_msg(0, "running on %s architecture", tmp); 78 78 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, "-----------------------------------------------------------"); 99 89 100 90 log_msg(0, "Zero..."); … … 107 97 log_msg(7, "Seven..."); 108 98 log_msg(8, "Eight..."); 109 printf("See %s for details of backup run.\n", MONDO_LOGFILE);110 99 } 111 100 112 113 extern char *g_magicdev_command;114 101 115 102 /** … … 174 161 printf("Initializing...\n"); 175 162 176 bkpinfo = (struct s_bkpinfo *)mr_malloc(sizeof(struct s_bkpinfo));177 163 init_bkpinfo(); 178 164 … … 316 302 317 303 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. */ 323 308 if (argc == 1) { 324 309 res = interactively_obtain_media_parameters_from_user(TRUE); /* yes, archiving */ 325 310 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."); 328 312 } 329 313 } else { 330 314 res = handle_incoming_parameters(argc, argv); 331 315 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"); 334 317 printf("Please review the log file - %s\n", MONDO_LOGFILE ); 335 318 log_msg(1, "Mondoarchive will now exit."); -
branches/2.2.10/mondo/src/mondoarchive/mondoarchive.h
r1967 r2340 9 9 */ 10 10 char *MONDO_LOGFILE = "/var/log/mondoarchive.log"; 11 char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVW b:c:d:ef:gik:l:mn:op:rs:tuw:x:z";11 char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVWYb:c:d:ef:gik:l:mn:op:rs:tuw:x:z"; 12 12 13 13 /* No restriction on ps options */
Note:
See TracChangeset
for help on using the changeset viewer.