Changeset 127 in MondoRescue for trunk/mondo/mondo/common/libmondo-filelist.c


Ignore:
Timestamp:
Nov 19, 2005, 2:27:31 AM (18 years ago)
Author:
bcornec
Message:

merge -r 125:126 $SVN_M/branches/2.05

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-filelist.c

    r120 r127  
    158158    log_msg(1, "Sorting file %s", orig_fname);
    159159    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));
    161161
    162162    if (!does_file_exist(orig_fname)) {
     
    165165
    166166    asprintf(&command, "sort %s > %s 2>> %s", orig_fname, tmp_fname,
    167             MONDO_LOGFILE);
     167             MONDO_LOGFILE);
    168168    retval = system(command);
    169169    paranoid_free(command);
     
    254254    if (!(fbig = fopen(biggie_fname, "w"))) {
    255255        log_OS_error("Cannot openout biggie_fname");
    256         return(0);
     256        return (0);
    257257    }
    258258    if (!(fout = fopen(outfname, "w"))) {
    259259        log_OS_error("Cannot openout outfname");
    260         return(0);
     260        return (0);
    261261    }
    262262    (void) fgets(&incoming, &n, fin);
     
    268268        }
    269269        /* BERLIOS: Useless with getline
    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         */
     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         */
    276276        if (incoming[i] < 32) {
    277277            incoming[i] = '\0';
     
    298298                curr_set_no++;
    299299                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);
    301302                if (!(fout = fopen(outfname, "w"))) {
    302303                    log_OS_error("Unable to openout outfname");
    303                     return(0);
     304                    return (0);
    304305                }
    305306                update_evalcall_form((int) (lino * 100 / noof_lines));
     
    327328        log_OS_error
    328329            ("Unable to echo write one-liner to LAST-FILELIST-NUMBER");
    329         return(0);
     330        return (0);
    330331    }
    331332    paranoid_free(outfname);
     
    423424        return (2);
    424425    }
    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)) {
    427427        fputs(tmp, pout);
    428428    }
     
    490490//      sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary
    491491        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);
    494494        iamhere(command);
    495495        retval = system(command);
     
    544544{
    545545    const int my_depth = 8;
    546     char *command, *syscall_pin, *syscall_pout; 
     546    char *command, *syscall_pin, *syscall_pout;
    547547    char *incoming = NULL;
    548     char *current_subset_file = NULL; 
     548    char *current_subset_file = NULL;
    549549    char *current_master_file, *masklist;
    550550    int retval = 0;
     
    561561                "No masklist provided. I shall therefore set ALL attributes.");
    562562        asprintf(&command, "cat %s | gzip -dc | %s --restore - 2>> %s",
    563                 original_exat_fname, executable, MONDO_LOGFILE);
     563                 original_exat_fname, executable, MONDO_LOGFILE);
    564564        log_msg(1, "command = %s", command);
    565565        retval = system(command);
     
    575575    }
    576576    asprintf(&masklist, "/tmp/%d.%d.mask", (int) (random() % 32768),
    577             (int) (random() % 32768));
     577             (int) (random() % 32768));
    578578    asprintf(&command, "cp -f %s %s", orig_msklist, masklist);
    579579    run_program_and_log_output(command, 1);
     
    583583    asprintf(&syscall_pin, "cat %s | gzip -dc", original_exat_fname);
    584584    asprintf(&syscall_pout, "%s --restore - 2>> %s", executable,
    585             MONDO_LOGFILE);
     585             MONDO_LOGFILE);
    586586
    587587    log_msg(1, "syscall_pin = %s", syscall_pin);
     
    774774        return (add_string_at_node(node->right, string_to_add));
    775775    }
    776 
    777776    // walk down tree if appropriate
    778777    if (node->down != NULL && node->ch == char_to_add) {
     
    788787        return (1);
    789788    }
    790 
    791789    // add here
    792790    if (!(newnode = (struct s_node *) malloc(sizeof(struct s_node)))) {
     
    904902
    905903    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)) {
    908905        if ((fname[strlen(fname) - 1] == 13
    909906             || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) {
     
    13261323 */
    13271324int 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)
    13291327{
    13301328    DIR *dip;
     
    13591357        // 2.6 has /sys as a proc-type thing -- must be excluded
    13601358        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);
    13631361#else
    13641362        // On BSD, for example, /sys is the kernel sources -- don't exclude
    13651363        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);
    13681366#endif
    13691367        system(tmp);
     
    14361434            asprintf(&new_with_spaces, " %s ", new);
    14371435            /* 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             */
    14421440            if (strstr(skip_these, new_with_spaces)) {
    14431441                fprintf(fout, "%s\n", new);
     
    14471445                        && S_ISDIR(statbuf.st_mode)) {
    14481446                        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);
    14501449                    } else {
    14511450                        if (time_of_last_full_backup == 0
     
    14571456                                uberctr++;
    14581457                                asprintf(&tmp, " %c ",
    1459                                         special_dot_char(uberctr));
     1458                                         special_dot_char(uberctr));
    14601459#ifndef _XWIN
    14611460                                if (!g_text_mode) {
     
    15471546    time_t time_of_last_full_backup = 0;
    15481547    struct stat statbuf;
    1549     char *skeleton_filelist; 
    1550     // The pathname to the skeleton filelist, used to give better progress reporting for mondo_makefilelist().
     1548    char *skeleton_filelist;
     1549    // The pathname to the skeleton filelist, used to give better progress reporting for mondo_makefilelist().
    15511550
    15521551    asprintf(&sz_datefile, sz_datefile_wildcard, 0);
     
    15651564    if (differential == 0) {
    15661565        // 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);
    15681568        run_program_and_log_output(command, 3);
    15691569        paranoid_free(command);
     
    15721572        if (does_file_exist(sz_datefile)) {
    15731573            asprintf(&command, "mv -f %s %s.aborted", sz_datefile,
    1574                     sz_datefile);
     1574                     sz_datefile);
    15751575            paranoid_system(command);
    15761576            paranoid_free(command);
     
    16301630                log_msg(1, "Including %s in filelist %s", q, sz_filelist);
    16311631                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);
    16331634                p += strlen(q);
    16341635                while (*p == ' ') {
     
    18191820        return (1);
    18201821    }
    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)) {
    18231823        if (!tmp[0]) {
    18241824            continue;
Note: See TracChangeset for help on using the changeset viewer.