Ignore:
Timestamp:
Jun 3, 2009, 7:10:19 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3089@localhost: bruno | 2009-05-18 06:41:05 +0200

  • move call to asprintf to call to mr_asprintf (suppress a compiler warning)
  • remove all the most obvious bad call to strcat and replace by mr_strcat as appropriate
File:
1 edited

Legend:

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

    r2206 r2211  
    1818#include "libmondo-tools-EXT.h"
    1919#include "mr_string.h"
     20#include "mr_mem.h"
    2021
    2122#include <time.h>
     
    484485        log_msg(8, "Analyzing %s", file_to_analyze);
    485486        tmp = mr_stresc(file_to_analyze, "`$\\\"(){}[]'*?&|!#~", '\\');
    486         (void)asprintf(&strtmp, syscall_sprintf, tmp);
     487        mr_asprintf(&strtmp, syscall_sprintf, tmp);
    487488        paranoid_free(tmp);
    488         (void)asprintf(&syscall, "%s 2>> /dev/null", strtmp);   // " MONDO_LOGFILE);
     489        mr_asprintf(&syscall, "%s 2>> /dev/null", strtmp);  // " MONDO_LOGFILE);
    489490        paranoid_free(strtmp);
    490491        call_exe_and_pipe_output_to_fd(syscall, pout);
     
    13891390        malloc_string(name_of_evalcall_form);
    13901391        malloc_string(find_skeleton_marker);
    1391         (void)asprintf(&find_excludes, " ");
     1392        mr_asprintf(&find_excludes, " ");
    13921393        while((token = mr_strtok (sth, delims, &lastpos))) {
    1393           (void)asprintf(&strtmp,"%s", find_excludes);
     1394          mr_asprintf(&strtmp,"%s", find_excludes);
    13941395          paranoid_free(find_excludes);
    1395           (void)asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);
     1396          mr_asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);
    13961397          paranoid_free(strtmp);
    13971398          paranoid_free(token);
     
    13991400#if linux
    14001401        // 2.6 has /sys as a proc-type thing -- must be excluded
    1401         (void)asprintf(&strtmp,
     1402        mr_asprintf(&strtmp,
    14021403             "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null",
    14031404             dir, find_excludes, g_skeleton_filelist);
    14041405#else
    14051406        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1406         (void)asprintf(&strtmp,
     1407        mr_asprintf(&strtmp,
    14071408             "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null",
    14081409                dir, find_excludes, g_skeleton_filelist);
     
    14121413        (void)system(strtmp);
    14131414        paranoid_free(strtmp);
    1414         (void)asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
     1415        mr_asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    14151416        g_skeleton_entries =
    14161417            1 + atol(call_program_and_get_last_line_of_output(tmp));
     
    14421443#ifndef _XWIN
    14431444                if (!g_text_mode) {
    1444                     (void)asprintf(&tmp, "Reading %-68s", dir);
     1445                    mr_asprintf(&tmp, "Reading %-68s", dir);
    14451446                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    14461447                    paranoid_free(tmp);
     
    14561457//  log_msg(0, "Cataloguing %s", dir);
    14571458    if (sth[0] == ' ') {
    1458         (void)asprintf(&skip_these, "%s", sth);
     1459        mr_asprintf(&skip_these, "%s", sth);
    14591460    } else {
    1460         (void)asprintf(&skip_these, " %s ", sth);
    1461     }
    1462     (void)asprintf(&new_with_spaces, " %s ", dir);
     1461        mr_asprintf(&skip_these, " %s ", sth);
     1462    }
     1463    mr_asprintf(&new_with_spaces, " %s ", dir);
    14631464    if ((dip = opendir(dir)) == NULL) {
    1464         (void)asprintf(&tmp,"opendir %s", dir);
     1465        mr_asprintf(&tmp,"opendir %s", dir);
    14651466        log_OS_error(tmp);
    14661467        paranoid_free(tmp);
     
    14721473            i++;
    14731474            if (strcmp(dir, "/")) {
    1474                 (void)asprintf(&new,"%s/%s",dir,dit->d_name);
     1475                mr_asprintf(&new,"%s/%s",dir,dit->d_name);
    14751476            } else {
    1476                 (void)asprintf(&new,"%s%s",dir,dit->d_name);
     1477                mr_asprintf(&new,"%s%s",dir,dit->d_name);
    14771478            }
    14781479            paranoid_free(new_with_spaces);
    1479             (void)asprintf(&new_with_spaces, " %s ", new);
     1480            mr_asprintf(&new_with_spaces, " %s ", new);
    14801481            if (strstr(skip_these, new_with_spaces)) {
    14811482                fprintf(fout, "%s\n", new);
     
    14961497                                counter = 0;
    14971498                                uberctr++;
    1498                                 (void)asprintf(&tmp, " %c ",
     1499                                mr_asprintf(&tmp, " %c ",
    14991500                                        special_dot_char(uberctr));
    15001501#ifndef _XWIN
     
    15501551    bool in_quotes = FALSE;
    15511552
    1552     (void)asprintf(&sz_res, "%s", incoming);
     1553    mr_asprintf(&sz_res, "%s", incoming);
    15531554    p = sz_res;
    15541555    while ((*p != ' ' || in_quotes) && *p != '\0') {
     
    15981599        fatal_error("Cannot malloc exclude_paths");
    15991600    }
    1600     (void)asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
     1601    mr_asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    16011602    if (!include_paths && !userdef_filelist) {
    16021603        fatal_error
     
    16061607    sprintf(command, "mkdir -p %s/archives", scratchdir);
    16071608    paranoid_system(command);
    1608     (void)asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);
     1609    mr_asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);
    16091610    make_hole_for_file(sz_filelist);
    16101611
     
    16461647        log_msg(2, "include_paths = '%s'", include_paths);
    16471648        log_msg(1, "Calculating filelist");
    1648         (void)asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1649        mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
    16491650        if (strlen(tmp2) < 1) {
    1650             (void)asprintf(&tmp1," ");
     1651            mr_asprintf(&tmp1," ");
    16511652        } else {
    16521653            log_msg(2, "Found windows FS: %s",tmp2);
    1653             (void)asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1654            mr_asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    16541655            paranoid_free(tmp2);
    1655             (void)asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1656            mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    16561657            log_msg(2, "Found windows files: %s",tmp2);
    16571658        }
Note: See TracChangeset for help on using the changeset viewer.