Ignore:
Timestamp:
Aug 18, 2009, 3:20:42 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3339@localhost: bruno | 2009-08-11 23:56:01 +0200
bkpinfo->kernel_path, bkpinfo->call_before_iso, bkpinfo->call_make_iso, bkpinfo->call_burn_iso, bkpinfo->call_after_iso and bkpinfo->postnuke_tarball are now dynamically allocated

File:
1 edited

Legend:

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

    r2327 r2328  
    11811181
    11821182    if ((flag_set['k']) && (! bkpinfo->restore_data)) {
    1183         strncpy(bkpinfo->kernel_path, flag_val['k'], MAX_STR_LEN);
     1183        mr_asprintf(bkpinfo->kernel_path, "%s", flag_val['k']);
    11841184        if (!strcmp(bkpinfo->kernel_path, "failsafe")) {
    1185             strcpy(bkpinfo->kernel_path, "FAILSAFE");
    1186         }
    1187         if (strcmp(bkpinfo->kernel_path, "FAILSAFE")
    1188             && !does_file_exist(bkpinfo->kernel_path)) {
     1185            mr_free(bkpinfo->kernel_path);
     1186            mr_asprintf(bkpinfo->kernel_path, "FAILSAFE");
     1187        }
     1188        if (strcmp(bkpinfo->kernel_path, "FAILSAFE") && !does_file_exist(bkpinfo->kernel_path)) {
    11891189            retval++;
    11901190            log_to_screen("You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
     
    12931293
    12941294    if ((flag_set['A']) && (! bkpinfo->restore_data)) {
    1295         strncpy(bkpinfo->call_after_iso, flag_val['A'], MAX_STR_LEN);
     1295        mr_asprintf(bkpinfo->call_after_iso, "%s", flag_val['A']);
    12961296    }
    12971297
    12981298    if ((flag_set['B']) && (! bkpinfo->restore_data)) {
    1299         strncpy(bkpinfo->call_before_iso, flag_val['B'], MAX_STR_LEN);
     1299        mr_asprintf(bkpinfo->call_before_iso, "%s", flag_val['B']);
    13001300    }
    13011301
     
    13141314#  endif
    13151315#endif
    1316         if (!strchr
    1317             (BOOT_LOADER_CHARS,
    1318              (bkpinfo->boot_loader = flag_val['l'][0]))) {
    1319             log_msg(1, "%c? WTF is %c? I need G, L, E or R.",
    1320                     bkpinfo->boot_loader, bkpinfo->boot_loader);
    1321             fatal_error
    1322                 ("Please specify GRUB, LILO, ELILO  or RAW with the -l switch");
     1316        if (!strchr(BOOT_LOADER_CHARS, (bkpinfo->boot_loader = flag_val['l'][0]))) {
     1317            log_msg(1, "%c? What is %c? I need G, L, E or R.", bkpinfo->boot_loader, bkpinfo->boot_loader);
     1318            fatal_error("Please specify GRUB, LILO, ELILO  or RAW with the -l switch");
    13231319        }
    13241320#undef BOOT_LOADER_CHARS
     
    13311327
    13321328    if ((flag_set['P']) && (! bkpinfo->restore_data)) {
    1333         strncpy(bkpinfo->postnuke_tarball, flag_val['P'], MAX_STR_LEN);
     1329        mr_free(bkpinfo->postnuke_tarball);
     1330        mr_asprintf(bkpinfo->postnuke_tarball, "%s", flag_val['P']);
    13341331    }
    13351332
Note: See TracChangeset for help on using the changeset viewer.