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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.