Ignore:
Timestamp:
Sep 25, 2013, 8:55:43 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • Modification to 3.1 branch to make it extremely similar to 3.0. What remains are function rewrite with allocation in the function and desallocation outside of the function. Will be next step
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1/mondo/src/common/libmondo-filelist.c

    r3161 r3190  
    2929
    3030
     31extern ssize_t getline(char **lineptr, size_t * n, FILE * stream);
    3132extern char *MONDO_LOGFILE;
    3233
     
    451452        }
    452453        log_msg(8, "Analyzing %s", file_to_analyze);
    453         tmp = mr_stresc(file_to_analyze, " `$\\\"(){}[]'*?&|!#~", '\\');
    454         mr_asprintf(strtmp, syscall_sprintf, tmp);
     454        tmp = mr_stresc(file_to_analyze, "'", '\\', '\'');
     455        mr_asprintf(syscall, "%s '%s' 2>> /dev/null", syscall_sprintf, tmp);    // " MONDO_LOGFILE);
    455456        mr_free(tmp);
    456 
    457         mr_asprintf(syscall, "%s 2>> /dev/null", strtmp);   // " MONDO_LOGFILE);
    458         mr_free(strtmp);
    459 
    460457        log_msg(20,"calling %s\n",syscall);
    461458        call_exe_and_pipe_output_to_fd(syscall, pout);
     
    480477        mr_free(command);
    481478
    482         retval =
    483             gen_aux_list(filelist, "getfacl --all-effective -P \"%s\"", facl_fname);
     479        retval = gen_aux_list(filelist, "getfacl --all-effective -P ", facl_fname);
    484480    }
    485481    return (retval);
     
    496492        run_program_and_log_output(command, 8);
    497493        mr_free(command);
    498         retval =
    499             gen_aux_list(filelist, "getfattr --en=hex -m - -h -d \"%s\"", fattr_fname);
     494        retval = gen_aux_list(filelist, "getfattr --en=hex -m - -h -d ", fattr_fname);
    500495    }
    501496    return (retval);
     
    13381333
    13391334    /* dir is needed when we pass it to the shell */
    1340     dir = mr_stresc(dir1, "`$\\\"(){}'[]&*?|!#~", '\\');
     1335    dir = mr_stresc(dir1, "'", '\\', '\'');
    13411336    p = strrchr(dir1, '/');
    13421337    if (p) {
     
    13461341        }
    13471342    }
    1348     mr_asprintf(find_excludes, "|");
     1343    mr_asprintf(find_excludes, " ");
    13491344
    13501345    if (!depth) {
    1351         mr_asprintf(find_excludes, "|");
    13521346        if (sth != NULL) {
    1353             while((token = mr_strtok(sth, delims, &lastpos))) {
     1347            while((token = mr_strtok(sth, delims, &lastpos)) != NULL) {
    13541348                mr_strcat(find_excludes," -path %s -prune -o", token);
    13551349                mr_free(token);
     
    13651359#if linux
    13661360        // 2.6 has /sys as a proc-type thing -- must be excluded
    1367         mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
     1361        mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
    13681362#else
    13691363        // On BSD, for example, /sys is the kernel sources -- don't exclude
     
    14221416//  log_msg(0, "Cataloguing %s", dir);
    14231417    mr_asprintf(skip_these, "|%s|", sth);
     1418   
    14241419    mr_asprintf(new_with_pipe, "|%s|", dir1);
    14251420    if ((dip = opendir(dir1)) == NULL) {
     
    14411436            }
    14421437            mr_free(new_with_pipe);
     1438            mr_asprintf(new_with_pipe, "|%s|", new);
    14431439            if (strstr(skip_these, new_with_pipe)) {
    14441440                fprintf(fout, "%s\n", new);
     
    14931489
    14941490
    1495 
    14961491/**
    14971492 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full.
     
    15921587        mr_asprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);
    15931588        make_hole_for_file(g_skeleton_filelist);
     1589
    15941590        log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries);
    15951591        log_msg(2, "Opening out filelist to %s", sz_filelist);
     
    15971593            fatal_error("Cannot openout to sz_filelist");
    15981594        }
    1599         if ((!include_paths) || (strlen(include_paths) == 0)) {
     1595        if ((include_paths != NULL) && (strlen(include_paths) == 0)) {
    16001596            log_msg(1, "Including only '/' in %s", sz_filelist);
    16011597            open_and_list_dir("/", exclude_paths, fout,
     
    16681664
    16691665    if (bkpinfo->make_filelist) {
    1670         res =
    1671             mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);
     1666        res = mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);
    16721667    } else {
    1673         res =
    1674             mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);
     1668        res = mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);
    16751669    }
    16761670
     
    17991793                }
    18001794                log_msg(5, "Found '%s'", fname);
    1801                 tmp = mr_stresc(fname, "[]*?", '\\');
     1795                tmp = mr_stresc(fname, "[]*?", '\\', "'");
    18021796                mr_free(fname);
    18031797                fname = tmp;
Note: See TracChangeset for help on using the changeset viewer.