Changeset 1856


Ignore:
Timestamp:
Jan 11, 2008, 1:39:17 PM (11 years ago)
Author:
bruno
Message:

solve the seg fault in snprintf due to a change of number of params

File:
1 edited

Legend:

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

    r1855 r1856  
    16971697    struct stat statbuf;
    16981698    char *tmp1 = NULL;
     1699    char *tmp2 = NULL;
    16991700
    17001701    malloc_string(command);
     
    17521753        log_msg(2, "include_paths = '%s'", include_paths);
    17531754        log_msg(1, "Calculating filelist");
    1754         asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|fat|vfat|dos' | awk '{print $3}'"));
    1755         snprintf(exclude_paths, (size_t)8*MAX_STR_LEN," %s %s %s %s %s %s %s . .. \
     1755        asprintf(&tmp2, call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|fat|vfat|dos' | awk '{print $3}'"));
     1756        if (strlen(tmp2) < 1) {
     1757            asprintf(&tmp1,"");
     1758        } else {
     1759            log_msg(2, "Found windows FS: %s",tmp2);
     1760            asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1761            paranoid_free(tmp2);
     1762            asprintf(&tmp2, call_program_and_get_last_line_of_output(tmp1));
     1763            log_msg(2, "Found windows files: %s",tmp2);
     1764        }
     1765        paranoid_free(tmp1);
     1766
     1767        snprintf(exclude_paths, (size_t)8*MAX_STR_LEN," %s %s %s %s %s . .. \
    17561768" MNT_CDROM " " MNT_FLOPPY " /media \
    1757 /proc /sys /root/images/mondo " MINDI_CACHE, MONDO_CACHE, excp, call_program_and_get_last_line_of_output(tmp1), (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
    1758         paranoid_free(tmp1);
     1769/proc /sys /root/images/mondo " MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1770        paranoid_free(tmp2);
    17591771
    17601772        log_msg(2, "Excluding paths = '%s'", exclude_paths);
Note: See TracChangeset for help on using the changeset viewer.