Changeset 127 in MondoRescue for trunk/mondo/mondo/common/libmondo-filelist.c
- Timestamp:
- Nov 19, 2005, 2:27:31 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-filelist.c
r120 r127 158 158 log_msg(1, "Sorting file %s", orig_fname); 159 159 asprintf(&tmp_fname, "/tmp/sort.%d.%d.%d", (int) (random() % 32768), 160 (int) (random() % 32768), (int) (random() % 32768));160 (int) (random() % 32768), (int) (random() % 32768)); 161 161 162 162 if (!does_file_exist(orig_fname)) { … … 165 165 166 166 asprintf(&command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, 167 MONDO_LOGFILE);167 MONDO_LOGFILE); 168 168 retval = system(command); 169 169 paranoid_free(command); … … 254 254 if (!(fbig = fopen(biggie_fname, "w"))) { 255 255 log_OS_error("Cannot openout biggie_fname"); 256 return (0);256 return (0); 257 257 } 258 258 if (!(fout = fopen(outfname, "w"))) { 259 259 log_OS_error("Cannot openout outfname"); 260 return (0);260 return (0); 261 261 } 262 262 (void) fgets(&incoming, &n, fin); … … 268 268 } 269 269 /* BERLIOS: Useless with getline 270 if (i > MAX_STR_LEN - 1) {271 272 273 274 }275 */270 if (i > MAX_STR_LEN - 1) { 271 incoming[MAX_STR_LEN - 30] = '\0'; 272 log_msg(1, "Warning - truncating file %s's name", incoming); 273 err++; 274 } 275 */ 276 276 if (incoming[i] < 32) { 277 277 incoming[i] = '\0'; … … 298 298 curr_set_no++; 299 299 curr_set_size = 0; 300 asprintf(&outfname, "%s/filelist.%ld", outdir, curr_set_no); 300 asprintf(&outfname, "%s/filelist.%ld", outdir, 301 curr_set_no); 301 302 if (!(fout = fopen(outfname, "w"))) { 302 303 log_OS_error("Unable to openout outfname"); 303 return (0);304 return (0); 304 305 } 305 306 update_evalcall_form((int) (lino * 100 / noof_lines)); … … 327 328 log_OS_error 328 329 ("Unable to echo write one-liner to LAST-FILELIST-NUMBER"); 329 return (0);330 return (0); 330 331 } 331 332 paranoid_free(outfname); … … 423 424 return (2); 424 425 } 425 for (getline(&tmp, &n, pattr); !feof(pattr); 426 getline(&tmp, &n, pattr)) { 426 for (getline(&tmp, &n, pattr); !feof(pattr); getline(&tmp, &n, pattr)) { 427 427 fputs(tmp, pout); 428 428 } … … 490 490 // sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary 491 491 asprintf(&command, 492 "cat %s | getfacl --all-effective -P - 2>> %s | gzip -c1 > %s 2>> %s",493 filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE);492 "cat %s | getfacl --all-effective -P - 2>> %s | gzip -c1 > %s 2>> %s", 493 filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE); 494 494 iamhere(command); 495 495 retval = system(command); … … 544 544 { 545 545 const int my_depth = 8; 546 char *command, *syscall_pin, *syscall_pout; 546 char *command, *syscall_pin, *syscall_pout; 547 547 char *incoming = NULL; 548 char *current_subset_file = NULL; 548 char *current_subset_file = NULL; 549 549 char *current_master_file, *masklist; 550 550 int retval = 0; … … 561 561 "No masklist provided. I shall therefore set ALL attributes."); 562 562 asprintf(&command, "cat %s | gzip -dc | %s --restore - 2>> %s", 563 original_exat_fname, executable, MONDO_LOGFILE);563 original_exat_fname, executable, MONDO_LOGFILE); 564 564 log_msg(1, "command = %s", command); 565 565 retval = system(command); … … 575 575 } 576 576 asprintf(&masklist, "/tmp/%d.%d.mask", (int) (random() % 32768), 577 (int) (random() % 32768));577 (int) (random() % 32768)); 578 578 asprintf(&command, "cp -f %s %s", orig_msklist, masklist); 579 579 run_program_and_log_output(command, 1); … … 583 583 asprintf(&syscall_pin, "cat %s | gzip -dc", original_exat_fname); 584 584 asprintf(&syscall_pout, "%s --restore - 2>> %s", executable, 585 MONDO_LOGFILE);585 MONDO_LOGFILE); 586 586 587 587 log_msg(1, "syscall_pin = %s", syscall_pin); … … 774 774 return (add_string_at_node(node->right, string_to_add)); 775 775 } 776 777 776 // walk down tree if appropriate 778 777 if (node->down != NULL && node->ch == char_to_add) { … … 788 787 return (1); 789 788 } 790 791 789 // add here 792 790 if (!(newnode = (struct s_node *) malloc(sizeof(struct s_node)))) { … … 904 902 905 903 open_evalcall_form("Loading filelist from disk"); 906 for (getline(&fname, &n, pin); !feof(pin); 907 getline(&fname, &n, pin)) { 904 for (getline(&fname, &n, pin); !feof(pin); getline(&fname, &n, pin)) { 908 905 if ((fname[strlen(fname) - 1] == 13 909 906 || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) { … … 1326 1323 */ 1327 1324 int open_and_list_dir(char *dir, char *sth, FILE * fout, 1328 time_t time_of_last_full_backup, char *skeleton_filelist) 1325 time_t time_of_last_full_backup, 1326 char *skeleton_filelist) 1329 1327 { 1330 1328 DIR *dip; … … 1359 1357 // 2.6 has /sys as a proc-type thing -- must be excluded 1360 1358 asprintf(&tmp, 1361 "find %s -maxdepth %d -path /proc -prune -o -path /tmp -prune -o -path /sys -prune -o -path /dev/shm -prune -o -path /media/floppy -prune -o -type d -a -print > %s 2> /dev/null",1362 dir, MAX_SKEL_DEPTH, skeleton_filelist);1359 "find %s -maxdepth %d -path /proc -prune -o -path /tmp -prune -o -path /sys -prune -o -path /dev/shm -prune -o -path /media/floppy -prune -o -type d -a -print > %s 2> /dev/null", 1360 dir, MAX_SKEL_DEPTH, skeleton_filelist); 1363 1361 #else 1364 1362 // On BSD, for example, /sys is the kernel sources -- don't exclude 1365 1363 asprintf(&tmp, 1366 "find %s -maxdepth %d -path /proc -prune -o -path /tmp -prune -o -type d -a -print > %s 2> /dev/null",1367 dir, MAX_SKEL_DEPTH, skeleton_filelist);1364 "find %s -maxdepth %d -path /proc -prune -o -path /tmp -prune -o -type d -a -print > %s 2> /dev/null", 1365 dir, MAX_SKEL_DEPTH, skeleton_filelist); 1368 1366 #endif 1369 1367 system(tmp); … … 1436 1434 asprintf(&new_with_spaces, " %s ", new); 1437 1435 /* BERLIOS: Old code 1438 new_with_spaces[0] = ' ';1439 strcpy(new_with_spaces + 1, new);1440 strcat(new_with_spaces, " ");1441 */1436 new_with_spaces[0] = ' '; 1437 strcpy(new_with_spaces + 1, new); 1438 strcat(new_with_spaces, " "); 1439 */ 1442 1440 if (strstr(skip_these, new_with_spaces)) { 1443 1441 fprintf(fout, "%s\n", new); … … 1447 1445 && S_ISDIR(statbuf.st_mode)) { 1448 1446 open_and_list_dir(new, skip_these, fout, 1449 time_of_last_full_backup, skeleton_filelist); 1447 time_of_last_full_backup, 1448 skeleton_filelist); 1450 1449 } else { 1451 1450 if (time_of_last_full_backup == 0 … … 1457 1456 uberctr++; 1458 1457 asprintf(&tmp, " %c ", 1459 special_dot_char(uberctr));1458 special_dot_char(uberctr)); 1460 1459 #ifndef _XWIN 1461 1460 if (!g_text_mode) { … … 1547 1546 time_t time_of_last_full_backup = 0; 1548 1547 struct stat statbuf; 1549 char *skeleton_filelist; 1550 1548 char *skeleton_filelist; 1549 // The pathname to the skeleton filelist, used to give better progress reporting for mondo_makefilelist(). 1551 1550 1552 1551 asprintf(&sz_datefile, sz_datefile_wildcard, 0); … … 1565 1564 if (differential == 0) { 1566 1565 // restore last good datefile if it exists 1567 asprintf(&command, "cp -f %s.aborted %s", sz_datefile, sz_datefile); 1566 asprintf(&command, "cp -f %s.aborted %s", sz_datefile, 1567 sz_datefile); 1568 1568 run_program_and_log_output(command, 3); 1569 1569 paranoid_free(command); … … 1572 1572 if (does_file_exist(sz_datefile)) { 1573 1573 asprintf(&command, "mv -f %s %s.aborted", sz_datefile, 1574 sz_datefile);1574 sz_datefile); 1575 1575 paranoid_system(command); 1576 1576 paranoid_free(command); … … 1630 1630 log_msg(1, "Including %s in filelist %s", q, sz_filelist); 1631 1631 open_and_list_dir(q, exclude_paths, fout, 1632 time_of_last_full_backup, skeleton_filelist); 1632 time_of_last_full_backup, 1633 skeleton_filelist); 1633 1634 p += strlen(q); 1634 1635 while (*p == ' ') { … … 1819 1820 return (1); 1820 1821 } 1821 for (getline(&tmp, &n, fin); !feof(fin); 1822 getline(&tmp, &n, fin)) { 1822 for (getline(&tmp, &n, fin); !feof(fin); getline(&tmp, &n, fin)) { 1823 1823 if (!tmp[0]) { 1824 1824 continue;
Note:
See TracChangeset
for help on using the changeset viewer.