Changeset 2318 in MondoRescue


Ignore:
Timestamp:
Aug 18, 2009, 2:36:47 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3329@localhost: bruno | 2009-08-05 00:33:17 +0200
bkpinfo->exclude_paths is now dynamically allocated

Location:
branches/2.2.10/mondo/src/common
Files:
6 edited

Legend:

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

    r2317 r2318  
    1313#include "my-stuff.h"
    1414#include "mr_mem.h"
     15#include "mr_str.h"
    1516#include "mondostructures.h"
    1617#include "libmondo-string-EXT.h"
     
    542543
    543544    assert(bkpinfo != NULL);
    544     mr_asprintf(&tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'",
    545             bkpinfo->exclude_paths);
     545    mr_asprintf(&tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths);
    546546    mr_asprintf(&devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));
    547547    mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2316 r2318  
    806806                    log_to_screen("Not archiving the following file systems:\n");
    807807                    log_to_screen("  %s\n", not_mounted_on_dsf);
    808                     strcat(bkpinfo->exclude_paths, not_mounted_on_dsf);
    809                     strcat(bkpinfo->exclude_paths, "");
     808                    mr_strcat(bkpinfo->exclude_paths, "%s ", not_mounted_on_dsf);
    810809                }
    811810                break;
     
    10951094            log_to_screen("Please supply a sensible value with '-E'\n");
    10961095        }
    1097         if (bkpinfo->exclude_paths[0]) {
    1098             strcat(bkpinfo->exclude_paths, " ");
    1099         }
     1096        mr_strcat(bkpinfo->exclude_paths, " ");
    11001097        mr_asprintf(&tmp1, "%s", flag_val['E']);
    11011098
     
    11401137                    log_to_screen("  %s\n", mounted_on_dsf);
    11411138                    log_msg (5, "Adding to bkpinfo->exclude_paths due to -E option: %s", mounted_on_dsf);
    1142                     strcat(bkpinfo->exclude_paths, mounted_on_dsf);
    1143                     strcat(bkpinfo->exclude_paths, " ");
     1139                    mr_strcat(bkpinfo->exclude_paths, "%s ", mounted_on_dsf);
     1140                    }
    11441141                }
    11451142                break;
     
    11501147            /* A device special file was not passed in. Process it as a path. */
    11511148            case -1:
    1152                 strcat(bkpinfo->exclude_paths, token);
    1153                 strcat(bkpinfo->exclude_paths, " ");
     1149                mr_strcat(bkpinfo->exclude_paths, "%s ", token);
    11541150                break;
    11551151            }
    11561152            mr_free(token);
    11571153        }
    1158         log_msg(1, "exclude_paths is now '%s'", bkpinfo->exclude_paths);
     1154        if (bkpinfo->exclude_paths != NULL) {
     1155            log_msg(1, "exclude_paths is now '%s'", bkpinfo->exclude_paths);
     1156        }
    11591157        log_msg(4, "Finished with the -E option");
    11601158    }
     
    11661164    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude NFS mounts & devices
    11671165    {
    1168 //      strncpy(psz, list_of_NFS_devices_and_mounts(), MAX_STR_LEN);
    11691166        mr_asprintf(&psz, "%s", list_of_NFS_mounts_only());
    1170         if (bkpinfo->exclude_paths[0]) {
    1171             strncat(bkpinfo->exclude_paths, " ", 4*MAX_STR_LEN);
    1172         }
    1173         strncat(bkpinfo->exclude_paths, psz, 4*MAX_STR_LEN);
     1167        mr_strcat(bkpinfo->exclude_paths, "%s ", psz);
    11741168        mr_free(psz);
    11751169
    1176         log_msg(3, "-N means we're now excluding %s",
    1177                 bkpinfo->exclude_paths);
    1178     }
    1179 
    1180     if (strlen(bkpinfo->exclude_paths) >= 4*MAX_STR_LEN) {
    1181         fatal_error
    1182             ("Your '-E' parameter is too long. Increase MAX_STR_LEN");
     1170        if (bkpinfo->exclude_paths != NULL) {
     1171            log_msg(3, "-N means we're now excluding %s", bkpinfo->exclude_paths);
     1172        }
    11831173    }
    11841174
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2316 r2318  
    19381938        mr_asprintf(&tmp, "%s", list_of_NFS_mounts_only());
    19391939        if (strlen(tmp) > 2) {
    1940             if (bkpinfo->exclude_paths[0]) {
    1941                 strcat(bkpinfo->exclude_paths, " ");
    1942             }
    1943             strncpy(bkpinfo->exclude_paths, tmp, MAX_STR_LEN);
     1940            mr_strcat(bkpinfo->exclude_paths, " %s",tmp);
    19441941        }
    19451942        mr_free(tmp);
     
    19631960            finish(1);
    19641961        }
    1965         strcpy(bkpinfo->exclude_paths, p);
    1966         mr_free(p);
     1962        mr_free(bkpinfo->exclude_paths);
     1963        bkpinfo->exclude_paths = p;
    19671964
    19681965        p = popup_and_get_string("Temporary directory", "Please enter your temporary directory.", bkpinfo->tmpdir);
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2316 r2318  
    5454    } else {
    5555        if (isdigit(partition[-1])) {
    56             mr_strcat(partition,
     56            mr_strcat(partition, "%c",
    5757#ifdef BSD
    5858                's');
     
    506506
    507507    q = ip;
    508     while ((p = strstr(q, token) != NULL)) {
     508    while ((p = strstr(q, token)) != NULL) {
    509509        *p = '\0';
    510510        if (output) {
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2317 r2318  
    814814    bkpinfo->make_filelist = TRUE;  // unless -J supplied to mondoarchive
    815815    bkpinfo->include_paths[0] = '\0';
    816     bkpinfo->exclude_paths[0] = '\0';
    817816    bkpinfo->restore_path[0] = '\0';
    818817    bkpinfo->call_before_iso[0] = '\0';
     
    823822    bkpinfo->nfs_mount[0] = '\0';
    824823    bkpinfo->nfs_user = NULL;
     824    bkpinfo->exclude_paths = NULL;
    825825    bkpinfo->nfs_remote_dir[0] = '\0';
    826826    bkpinfo->postnuke_tarball[0] = '\0';
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2316 r2318  
    427427                mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
    428428                system(command);
    429                 paranoid_free(command);
     429                mr_free(command);
    430430            }
    431431        }
     
    436436                mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
    437437                system(command);
    438                 paranoid_free(command);
     438                mr_free(command);
    439439            }
    440440        }
    441441        /* Free all allocated strings in bkpinfo */
    442442        mr_free(bkpinfo->nfs_user);
     443        mr_free(bkpinfo->exclude_paths);
    443444
    444445        /* Then free the structure */
Note: See TracChangeset for help on using the changeset viewer.