Ignore:
Timestamp:
Sep 10, 2009, 2:55:51 AM (15 years ago)
Author:
Bruno Cornec
Message:

call_program_and_get_last_line_of_output is now allocating memory and returning that string

File:
1 edited

Legend:

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

    r2382 r2383  
    860860    char *fname = NULL;
    861861    char *tmp = NULL;
     862    char *tmp1 = NULL;
    862863    int pos_in_fname;
    863864    /*@ int ******************************************************** */
     
    877878    mr_asprintf(tmp, "zcat %s | wc -l", filelist_fname);
    878879    log_msg(6, "tmp = %s", tmp);
    879     lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp));
     880
     881    tmp1 = call_program_and_get_last_line_of_output(tmp);
    880882    mr_free(tmp);
     883
     884    lines_in_filelist = atol(tmp1);
     885    mr_free(tmp1);
    881886
    882887    if (lines_in_filelist < 3) {
     
    13201325    char *new;
    13211326    char *tmp = NULL;
     1327    char *tmp1 = NULL;
    13221328    char *dir = NULL;
    13231329    static int percentage = 0;
     
    13701376
    13711377        mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    1372         g_skeleton_entries = 1 + atol(call_program_and_get_last_line_of_output(tmp));
     1378        tmp1 = call_program_and_get_last_line_of_output(tmp);
    13731379        mr_free(tmp);
     1380
     1381        g_skeleton_entries = 1 + atol(tmp1);
     1382        mr_free(tmp1);
    13741383
    13751384        mr_asprintf(name_of_evalcall_form, "Making catalog of %s", dir);
     
    15331542        }
    15341543        make_hole_for_file(sz_datefile);
    1535         write_one_liner_data_file(sz_datefile,
    1536                                   call_program_and_get_last_line_of_output
    1537                                   ("date +%s"));
     1544        tmp1 = call_program_and_get_last_line_of_output("date +%s");
     1545        write_one_liner_data_file(sz_datefile, tmp1);
     1546        mr_free(tmp1);
    15381547    } else if (lstat(sz_datefile, &statbuf)) {
    15391548        log_msg(2, "Warning - unable to find date of previous backup. Full backup instead.");
     
    15601569        }
    15611570        log_msg(1, "Calculating filelist");
    1562         mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1571        tmp2 = call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'");
    15631572        if (strlen(tmp2) < 1) {
    15641573            mr_asprintf(tmp1," ");
     
    15671576            mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    15681577            mr_free(tmp2);
    1569             mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1578            tmp2 = call_program_and_get_last_line_of_output(tmp1);
    15701579            log_msg(2, "Found windows files: %s",tmp2);
    15711580        }
Note: See TracChangeset for help on using the changeset viewer.