Changeset 2325


Ignore:
Timestamp:
Aug 18, 2009, 3:19:15 PM (10 years ago)
Author:
bruno
Message:

r3336@localhost: bruno | 2009-08-11 16:32:36 +0200

  • bkpinfo->media_device, bkpinfo->nfs_remote_dir, and bkpinfo->nfs_mount are now dynamically allocated
  • new interfaces for find_cdrom_device(), find_tape_device_and_size(), find_dvd_device(), find_cdrw_device(), set_dev_to_this_if_rx_OK() and read_cfg_var() which allocate the string now returned
  • Better differentiation between ISO and NFS iso file names construction
Location:
branches/2.2.10/mondo/src
Files:
26 edited

Legend:

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

    r2324 r2325  
    561561    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    562562        mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size[1]);
    563         ntapedev = get_non_rewind_dev(bkpinfo->media_device);
     563        if (bkpinfo->media_device) {
     564            ntapedev = get_non_rewind_dev(bkpinfo->media_device);
     565        }
    564566        if ((bkpinfo->use_obdr) && (ntapedev != NULL)) {
    565             strncpy(bkpinfo->media_device,ntapedev,(size_t)(MAX_STR_LEN / 4));
     567            mr_free(bkpinfo->media_device);
     568            mr_asprintf(bkpinfo->media_device,"%s",ntapedev);
    566569        } else {
    567570            if (ntapedev == NULL) {
     
    569572            }
    570573        }
    571         paranoid_free(ntapedev);
    572         mr_asprintf(tape_device, "%s", bkpinfo->media_device);
     574        mr_free(ntapedev);
     575        if (bkpinfo->media_device) {
     576            mr_asprintf(tape_device, "%s", bkpinfo->media_device);
     577        } else {
     578            mr_asprintf(tape_device, "");
     579        }
    573580    } else {
    574581        mr_asprintf(tape_size_sz, "%ld", 0L);;
     
    759766        fatal_error("Unknown backup_media_type");
    760767    }
    761     if (bkpinfo->backup_media_type == usb) {
     768    if ((bkpinfo->backup_media_type == usb) && (bkpinfo->media_device)) {
    762769        mr_asprintf(tmp2, "--usb %s", bkpinfo->media_device);
    763770    } else {
     
    11971204    mr_free(data_disks_file);
    11981205
    1199     mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
    1200     paranoid_system(command);
    1201     mr_free(command);
     1206    if ((bkpinfo->isodir != NULL) && (bkpinfo->prefix != NULL)) {
     1207        if (bkpinfo->nfs_remote_dir) {
     1208            // NFS
     1209            mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
     1210        } else {
     1211            // ISO
     1212            mr_asprintf(command, "rm -f %s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->prefix);
     1213        }
     1214        paranoid_system(command);
     1215        mr_free(command);
     1216    }
    12021217
    12031218    wipe_archives(bkpinfo->scratchdir);
     
    15161531    log_msg(1, message_to_screen);
    15171532
    1518     mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
     1533    if (bkpinfo->media_device) {
     1534        mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
     1535    } else {
     1536        mr_asprintf(tmp1, "");
     1537    }
    15191538    if (is_this_device_mounted(tmp1)) {
    15201539        log_msg(1, "USB device mounted. Remounting it at the right place");
     
    17001719                }
    17011720                pause_for_N_seconds(5, "Letting DVD drive settle");
    1702                 mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
     1721                if (bkpinfo->media_device) {
     1722                    mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
     1723                } else {
     1724                    mr_asprintf(sz_blank_disk, "dvd+rw-format");
     1725                }
    17031726                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    1704                 res =
    1705                     run_external_binary_with_percentage_indicator_NEW
    1706                     ("Blanking DVD disk", sz_blank_disk);
     1727                res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk);
    17071728                if (res) {
    17081729                    log_to_screen
     
    18201841        || bkpinfo->backup_media_type == cdrw) {
    18211842        if (is_this_device_mounted(bkpinfo->media_device)) {
    1822             log_msg(2,
    1823                     "Warning - %s mounted. I'm unmounting it before I burn to it.",
    1824                     bkpinfo->media_device);
     1843            log_msg(2, "Warning - %s mounted. I'm unmounting it before I burn to it.", bkpinfo->media_device);
    18251844            mr_asprintf(tmp, "umount %s", bkpinfo->media_device);
    18261845            run_program_and_log_output(tmp, FALSE);
     
    26042623    /*@ buffers ********************************************* */
    26052624    char *tmp = NULL;
    2606     char *cdrom_dev;
     2625    char *cdrom_dev = NULL;
    26072626    char *cdrw_dev;
    26082627    char *our_serial_str = NULL;
     
    26162635    char *mds = NULL;
    26172636
    2618     malloc_string(cdrom_dev);
    26192637    malloc_string(cdrw_dev);
    26202638    malloc_string(szcdno);
     
    26342652  gotos_make_me_puke:
    26352653    ok_go_ahead_burn_it = TRUE;
    2636     if (!find_cdrom_device(cdrom_dev, FALSE)) {
    2637 /* When enabled, it made CD eject-and-retract when wrong CD inserted.. Weird
    2638       log_msg(2, "paafcd: Retracting CD-ROM drive if possible" );
    2639       retract_CD_tray_and_defeat_autorun();
    2640 */
     2654    if ((cdrom_dev = find_cdrom_device(FALSE)) != NULL) {
     2655        /* When enabled, it made CD eject-and-retract when wrong CD inserted.. Weird
     2656        log_msg(2, "paafcd: Retracting CD-ROM drive if possible" );
     2657        retract_CD_tray_and_defeat_autorun();
     2658        */
    26412659        mr_asprintf(tmp, "umount %s", cdrom_dev);
    26422660        run_program_and_log_output(tmp, 1);
     
    27182736        popup_and_OK(tmp);
    27192737        mr_free(tmp);
     2738        mr_free(cdrom_dev);
    27202739        goto gotos_make_me_puke;
    27212740    } else {
    27222741        log_msg(2, "paafcd: OK, going ahead and burning it.");
    27232742    }
     2743    mr_free(cdrom_dev);
    27242744
    27252745    mds = media_descriptor_string(g_backup_media_type);
     
    27302750    mr_free(mds);
    27312751
    2732     paranoid_free(cdrom_dev);
    27332752    paranoid_free(cdrw_dev);
    27342753    paranoid_free(mtpt);
     
    31873206
    31883207    /*@ buffers ***************************************************** */
    3189     char *tmp;
    3190     char *tmp1;
     3208    char *tmp = NULL;
     3209    char *tmp1 = NULL;
    31913210    char *cdno_fname = NULL;
    31923211    char *lastcd_fname = NULL;
     
    32003219    /*@ int *********************************************************** */
    32013220    int res = 0;
    3202 
    3203     malloc_string(tmp);
    32043221
    32053222    assert(bkpinfo != NULL);
     
    32463263        log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]);
    32473264    }
    3248     mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     3265    if (((bkpinfo->isodir == NULL) && (bkpinfo->nfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
     3266        fatal_error("Something wrong in your environement. Report to dev team");
     3267    }
     3268    if (bkpinfo->nfs_remote_dir) {
     3269        // NFS
     3270        mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     3271    } else {
     3272        // ISO
     3273        mr_asprintf(isofile, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);
     3274    }
    32493275    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    32503276        if (bkpinfo->backup_media_type != usb) {
     
    32563282            && (bkpinfo->backup_media_type == cdr
    32573283                || bkpinfo->backup_media_type == cdrw)) {
    3258             if (find_cdrom_device(tmp, FALSE))  // make sure find_cdrom_device() finds, records CD-R's loc
    3259             {
     3284            if ((tmp = find_cdrom_device(FALSE)) == NULL) {
     3285                // make sure find_cdrom_device() finds, records CD-R's loc
    32603286                log_msg(3, "*Sigh* Mike, I hate your computer.");
     3287                // if it can't be found then force pausing
    32613288                bkpinfo->manual_cd_tray = TRUE;
    3262             }                   // if it can't be found then force pausing
    3263             else {
     3289            } else {
    32643290                log_msg(3, "Great. Found Mike's CD-ROM drive.");
    32653291            }
     3292            mr_free(tmp);
    32663293        }
    32673294        if (bkpinfo->verify_data && !res) {
    32683295            mds = media_descriptor_string(g_backup_media_type);
    3269             log_to_screen
    3270                 ("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds);
     3296            log_to_screen("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds);
    32713297            mr_free(mds);
    32723298            chdir("/");
     
    33203346
    33213347    bkpinfo->verify_data = orig_vfy_flag_val;
    3322     mr_free(tmp);
    33233348    return (0);
    33243349}
     
    33533378                            "Verifying archives against live filesystem");
    33543379        if (bkpinfo->backup_media_type == cdstream) {
    3355             strcpy(bkpinfo->media_device, "/dev/cdrom");
     3380            mr_free(bkpinfo->media_device);
     3381            mr_asprintf(bkpinfo->media_device, "/dev/cdrom");
    33563382        }
    33573383        verify_tape_backups();
     
    33683394        g_current_media_number = cdno;
    33693395        if (bkpinfo->backup_media_type != iso) {
    3370             find_cdrom_device(bkpinfo->media_device, FALSE);    // replace 0,0,0 with /dev/cdrom
     3396            mr_free(bkpinfo->media_device);
     3397            bkpinfo->media_device = find_cdrom_device(FALSE);   // replace 0,0,0 with /dev/cdrom
    33713398        }
    33723399        chdir("/");
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2324 r2325  
    114114        }
    115115    }
    116     mr_asprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);
    117     paranoid_system(tmp);
    118     mr_free(tmp);
    119 
    120     mr_asprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);
    121     paranoid_system(tmp);
    122     mr_free(tmp);
    123 
    124     mr_strcat(bkpinfo->scratchdir, "/mondo.scratch.%ld", random() % 32767);
    125 
    126116    mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
    127117    paranoid_system(tmp);
     
    889879    if ((flag_set['t'] && !flag_set['d']) && (! bkpinfo->restore_data)) {
    890880        log_it("Hmm! No tape drive specified. Let's see what we can do.");
    891         p = mr_find_tape_device();
    892         if (!p) {
     881        if ((tmp1 = find_tape_device_and_size(NULL)) == NULL) {
    893882            fatal_error("Tape device not specified. I couldn't find it either.");
    894883        }
     884        strcpy(flag_val['d'], tmp1);
     885        mr_free(tmp1);
    895886        flag_set['d'] = TRUE;
    896887        strcpy(flag_val['d'], p);
     
    917908        }
    918909        if (!flag_set['d']) {
    919             if (!find_dvd_device(flag_val['d'], FALSE)) {
     910            if ((tmp = find_dvd_device(flag_val['d'])) != NULL) {
     911                strcpy(flag_val['d'],tmp);
     912                mr_free(tmp);
    920913                flag_set['d'] = TRUE;
    921914                log_to_screen("I guess DVD drive is at %s", flag_val['d']);
     
    923916        }
    924917        if (strchr(flag_val['d'], ',')) {
    925             fatal_error
    926                 ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
     918            fatal_error("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    927919        }
    928920        if (! bkpinfo->restore_data) {
    929921            if (!find_home_of_exe("growisofs")) {
    930                 fatal_error
    931                     ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
     922                fatal_error("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    932923            }
    933924            if (!find_home_of_exe("dvd+rw-format")) {
    934                 fatal_error
    935                     ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
     925                fatal_error("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    936926            }
    937927            if (!flag_set['s']) {
    938928                sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
    939929                strcat(flag_val['s'], "m");
    940                 log_to_screen
    941                     ("You did not specify a size (-s) for DVD. I'm guessing %s.",
    942                     flag_val['s']);
     930                log_to_screen("You did not specify a size (-s) for DVD. I'm guessing %s.", flag_val['s']);
    943931                flag_set['s'] = 1;
    944932            }
     
    948936    if (flag_set['t'] || flag_set['u']) {   /* tape size */
    949937        if (strchr(flag_val['d'], ',')) {
    950             fatal_error
    951                 ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
     938            fatal_error("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    952939        }
    953940        if ((flag_set['O']) && (! bkpinfo->restore_data)) {
     
    981968
    982969    if (flag_set['n']) {
    983         strncpy(bkpinfo->nfs_mount, flag_val['n'], MAX_STR_LEN);
     970        mr_free(bkpinfo->nfs_mount);
     971        mr_asprintf(bkpinfo->nfs_mount, "%s", flag_val['n']);
    984972        if (!flag_set['d']) {
    985             strncpy(bkpinfo->nfs_remote_dir, "/", MAX_STR_LEN);
     973            mr_free(bkpinfo->nfs_remote_dir);
     974            mr_asprintf(bkpinfo->nfs_remote_dir, "/");
    986975        }
    987976        /* test if we specified a user for the NFS dialog */
     
    989978        if (p != NULL) {
    990979            /* User found. Store the 2 values */
     980            bkpinfo->nfs_user = bkpinfo->nfs_mount;
    991981            p++;
    992982            /* new NFS mount */
    993             strcpy(tmp,p);
     983            bkpinfo->nfs_mount = p;
    994984            p--;
    995985            *p = '\0';
    996             mr_asprintf(bkpinfo->nfs_user,"%s",p);
    997             strcpy(bkpinfo->nfs_mount,tmp);
    998986        }
    999987        mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     
    12211209            mr_free(tmp1);
    12221210        } else if (flag_set['n']) {
    1223             strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN);
     1211            mr_free(bkpinfo->nfs_remote_dir);
     1212            mr_asprintf(bkpinfo->nfs_remote_dir, "%s", flag_val['d']);
    12241213        } else {                /* backup device (if tape/CD-R/CD-RW) */
    1225             strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4);
     1214            mr_free(bkpinfo->media_device);
     1215            mr_asprintf(bkpinfo->media_device, "%s", flag_val['d']);
    12261216        }
    12271217    }
     
    12451235    }
    12461236
    1247     if (!flag_set['d']
    1248         && (flag_set['c'] || flag_set['w'] || flag_set['C'])) {
     1237    if (!flag_set['d'] && (flag_set['c'] || flag_set['w'] || flag_set['C'])) {
    12491238        if (g_kernel_version >= 2.6) {
    12501239            tmp2 = popup_and_get_string("Device", "Please specify the device", bkpinfo->media_device);
    12511240            if (tmp2 == NULL) {
     1241                fatal_error("User opted to cancel.");
     1242            }
     1243            bkpinfo->media_device = tmp2;
     1244        } else {
     1245            bkpinfo->media_device = find_cdrw_device();
     1246            if (bkpinfo->media_device == NULL) {
    12521247                retval++;
    1253                 log_to_screen("User opted to cancel.");
    1254             }
    1255             mr_free(tmp2);
    1256         } else if (find_cdrw_device(bkpinfo->media_device)) {
    1257             retval++;
    1258             log_to_screen
    1259                 ("Tried and failed to find CD-R[W] drive automatically.\n");
    1260         } else {
    1261             flag_set['d'] = TRUE;
    1262             strncpy(flag_val['d'], bkpinfo->media_device, MAX_STR_LEN / 4);
     1248                log_to_screen("Tried and failed to find CD-R[W] drive automatically.\n");
     1249            } else {
     1250                flag_set['d'] = TRUE;
     1251                strncpy(flag_val['d'], bkpinfo->media_device, MAX_STR_LEN / 4);
     1252            }
    12631253        }
    12641254    }
     
    12881278
    12891279        if (i) {
    1290             retval++;
    12911280            log_to_screen("Please specify a tempdir which I can write to. :)");
    12921281            fatal_error("I cannot write to the tempdir you specified.");
     
    14671456    /*@ ints ** */
    14681457    int opt = 0;
    1469     char *tmp = NULL;
    14701458    int i = 0;
    14711459    int len;
  • branches/2.2.10/mondo/src/common/libmondo-devices-EXT.h

    r2321 r2325  
    99extern int find_and_mount_actual_cd(
    1010                                    char *mountpoint);
    11 extern int find_cdrom_device(char *output, bool try_to_mount);
    12 extern int find_dvd_device(char *output, bool try_to_mount);
     11extern char *find_cdrom_device(bool try_to_mount);
     12extern char *find_dvd_device();
    1313extern long get_phys_size_of_drive(char *drive);
    1414extern bool is_this_a_valid_disk_format(char *format);
     
    1616extern int find_device_in_mountlist(struct mountlist_itself *mountlist,
    1717                                    char *device);
    18 extern int mount_CDROM_here(char *device, char *mountpoint);
     18extern int mount_CDROM_here(char *device, const char *mountpoint);
    1919extern long long size_of_specific_device_in_mountlist(struct
    2020                                                      mountlist_itself
     
    2828
    2929
    30 extern int find_cdrw_device(char *cdrw_device);
     30extern char *find_cdrw_device();
    3131
    3232
     
    5252
    5353
    54 extern bool set_dev_to_this_if_rx_OK(char *, char *);
     54extern char *set_dev_to_this_if_rx_OK(char *);
    5555
    5656extern void retract_CD_tray_and_defeat_autorun(void);
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2324 r2325  
    6464
    6565
    66 void set_g_cdrom_and_g_dvd_to_bkpinfo_value()
    67 {
    68     strcpy(g_cdrom_drive_is_here, bkpinfo->media_device);   // just in case
    69     strcpy(g_dvd_drive_is_here, bkpinfo->media_device); // just in case
     66void set_g_cdrom_and_g_dvd_to_bkpinfo_value() {
     67
     68    if (bkpinfo->media_device) {
     69        strcpy(g_cdrom_drive_is_here, bkpinfo->media_device);   // just in case
     70        strcpy(g_dvd_drive_is_here, bkpinfo->media_device); // just in case
     71    }
    7072}
    7173
     
    205207    int res1 = 0, res2 = 0;
    206208
     209    if (dev == NULL) {
     210        return (1);
     211    }
     212
    207213    if (IS_THIS_A_STREAMING_BACKUP(g_backup_media_type)
    208214        && g_backup_media_type != udev) {
     
    243249    char *command = NULL;
    244250    int i;
     251
     252    if (dev == NULL) {
     253        return (1);
     254    }
    245255
    246256#ifdef __FreeBSD__
     
    429439 * Try to mount CD-ROM at @p mountpoint. If the CD-ROM is not found or has
    430440 * not been specified, call find_cdrom_device() to find it.
    431  * @param bkpinfo The backup information structure. The only field used is @c bkpinfo->media_device.
    432441 * @param mountpoint Where to mount the CD-ROM.
    433442 * @return 0 for success, nonzero for failure.
    434443 * @see mount_CDROM_here
    435444 */
    436 int find_and_mount_actual_cd(char *mountpoint)
    437 {
     445int find_and_mount_actual_cd(char *mountpoint) {
     446
    438447    /*@ buffers ***************************************************** */
    439448
    440449    /*@ int's  ****************************************************** */
    441450    int res;
    442     char *dev;
     451    char *dev = NULL;
    443452    char *p = NULL;
    444453
    445454    /*@ end vars **************************************************** */
    446455
    447     malloc_string(dev);
    448456    assert(bkpinfo != NULL);
    449457    assert_string_is_neither_NULL_nor_zerolength(mountpoint);
    450458
    451459    if (g_backup_media_type == dvd) {
    452         strcpy(dev, g_dvd_drive_is_here);
    453         if (!dev[0]) {
    454             find_dvd_device(dev, FALSE);
     460        if (g_dvd_drive_is_here[0]) {
     461            mr_asprintf(dev, "%s", g_dvd_drive_is_here);
     462        }
     463        if (dev == NULL) {
     464            dev = find_dvd_device();
    455465        }
    456466    } else {
    457         strcpy(dev, g_cdrom_drive_is_here);
    458         if (!dev[0]) {
    459             find_cdrom_device(dev, FALSE);
     467        if (g_cdrom_drive_is_here[0]) {
     468            mr_asprintf(dev, "%s", g_cdrom_drive_is_here);
     469        }
     470        if (dev == NULL) {
     471            dev = find_cdrom_device(FALSE);
    460472        }
    461473    }
     
    465477    }
    466478
    467     if (!dev[0] || (res = mount_CDROM_here(dev, mountpoint))) {
     479    if ((dev == NULL) || (res = mount_CDROM_here(dev, mountpoint))) {
    468480        p = popup_and_get_string ("CD-ROM device", "Please enter your CD-ROM's /dev device",dev);
    469481        if (p == NULL) {
     
    479491        log_msg(1, "mount succeeded with %s", dev);
    480492    }
    481     paranoid_free(dev);
     493    mr_free(dev);
    482494    return (res);
    483495}
     
    493505 * @return 0 for success, nonzero for failure.
    494506 */
    495 int find_cdrw_device(char *cdrw_device)
     507char *find_cdrw_device()
    496508{
    497509    /*@ buffers ************************ */
     
    499511    char *cdr_exe = NULL;
    500512    char *command = NULL;
     513    char *cdrw_device = NULL;
    501514
    502515    if (g_cdrw_drive_is_here[0]) {
    503         strcpy(cdrw_device, g_cdrw_drive_is_here);
     516        mr_asprintf(cdrw_device, g_cdrw_drive_is_here);
    504517        log_msg(3, "Been there, done that. Returning %s", cdrw_device);
    505         return (0);
     518        return(cdrw_device);
    506519    }
    507520    if (g_backup_media_type == dvd) {
    508         log_msg(1,
    509                 "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");
    510         return (1);
     521        log_msg(1, "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");
     522        return(NULL);
    511523    }
    512524    run_program_and_log_output("insmod ide-scsi", -1);
     
    524536        mr_free(tmp);
    525537        mr_free(cdr_exe);
    526         return 1;
     538        return(NULL);
    527539    } else {
    528         strcpy(cdrw_device, tmp);
     540        cdrw_device = tmp;
    529541        log_it("Found CDRW device - %s", cdrw_device);
    530542        strcpy(g_cdrw_drive_is_here, cdrw_device);
    531         mr_free(tmp);
    532543        mr_free(cdr_exe);
    533         return (0);
     544        return (cdrw_device);
    534545    }
    535546}
     
    545556 * @return 0 for success, nonzero for failure.
    546557 */
    547 int find_cdrom_device(char *output, bool try_to_mount)
     558char *find_cdrom_device(bool try_to_mount)
    548559{
    549560    /*@ pointers **************************************************** */
     
    552563    char *q;
    553564    char *r;
    554     int retval = 0;
    555565
    556566    /*@ bool's ****************************************************** */
     
    558568
    559569    /*@ buffers ***************************************************** */
    560     char *tmp;
     570    char *tmp = NULL;
    561571    char *tmp1 = NULL;
     572    char *output = NULL;
    562573    char *cdr_exe = NULL;
    563     char *phrase_one;
    564     char *phrase_two;
     574    char *phrase_one = NULL;
     575    char *phrase_two = NULL;
    565576    char *command = NULL;
    566577#ifndef __FreeBSD__
     
    571582
    572583    /*@ intialize *************************************************** */
    573     malloc_string(tmp);
    574     malloc_string(phrase_one);
    575     malloc_string(phrase_two);
    576 
    577     output[0] = '\0';
    578     phrase_one[0] = '\0';
    579     phrase_two[0] = '\0';
     584
     585    output = NULL;
    580586#ifndef __FreeBSD__
    581587    mr_asprintf(dvd_last_resort, "%s", "");;
     
    585591
    586592    if (g_cdrom_drive_is_here[0] && !isdigit(g_cdrom_drive_is_here[0])) {
    587         strcpy(output, g_cdrom_drive_is_here);
     593        mr_asprintf(output, "%s", g_cdrom_drive_is_here);
    588594        log_msg(3, "Been there, done that. Returning %s", output);
    589         retval = 0;
    590         goto end_of_find_cdrom_device;
     595        return(output);
    591596    }
    592597    if (the_last_place_i_found_it[0] != '\0' && !try_to_mount) {
    593         strcpy(output, the_last_place_i_found_it);
    594         log_msg(3,
    595                 "find_cdrom_device() --- returning last found location - '%s'",
    596                 output);
    597         retval = 0;
    598         goto end_of_find_cdrom_device;
     598        mr_asprintf(output, "%s", the_last_place_i_found_it);
     599        log_msg(3, "find_cdrom_device() --- returning last found location - '%s'", output);
     600        return(output);
    599601    }
    600602
     
    607609        mr_asprintf(cdr_exe, "dvdrecord");
    608610    }
    609     tmp[0] = '\0';
     611
    610612    if (!find_home_of_exe(cdr_exe)) {
    611         strcpy(output, "/dev/cdrom");
     613        mr_asprintf(output, "/dev/cdrom");
    612614        log_msg(4, "Can't find cdrecord; assuming %s", output);
     615        mr_free(cdr_exe);
    613616        if (!does_device_exist(output)) {
    614617            log_msg(4, "That didn't work. Sorry.");
    615             retval = 1;
    616             goto end_of_find_cdrom_device;
     618            mr_free(output);
     619            return(output);
    617620        } else {
    618             retval = 0;
    619             goto end_of_find_cdrom_device;
     621            return(output);
    620622        }
    621623    }
     
    629631        log_OS_error("Cannot popen command");
    630632        mr_free(cdr_exe);
    631         return (1);
    632     }
    633 
     633        return(NULL);
     634    }
     635
     636    malloc_string(phrase_one);
     637    phrase_one[0] = '\0';
     638    malloc_string(phrase_two);
     639    phrase_two[0] = '\0';
     640
     641    malloc_string(tmp);
     642    tmp[0] = '\0';
    634643    for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    635644         (void)fgets(tmp, MAX_STR_LEN, fin)) {
     
    656665    }
    657666    paranoid_pclose(fin);
     667    paranoid_free(phrase_one);
    658668
    659669#ifndef __FreeBSD__
     
    678688                            mr_free(dvd_last_resort);
    679689                            mr_asprintf(dvd_last_resort, "/dev/%s", tmp);
    680                             log_msg(4,
    681                                     "Ignoring '%s' because it's a DVD drive",
    682                                     tmp);
     690                            log_msg(4, "Ignoring '%s' because it's a DVD drive", tmp);
    683691                        } else {
    684                             sprintf(output, "/dev/%s", tmp);
     692                            mr_asprintf(output, "/dev/%s", tmp);
    685693                            found_it = TRUE;
    686694                        }
     
    691699        }
    692700    }
     701    paranoid_free(phrase_two);
     702    paranoid_free(tmp);
    693703
    694704#endif
     
    696706    if (!found_it) {
    697707        log_msg(4, "OK, approach 2");
    698         if (!(found_it = set_dev_to_this_if_rx_OK(output, "/dev/cdrom"))) {
    699             if (!
    700                 (found_it =
    701                  set_dev_to_this_if_rx_OK(output, "/dev/cdrom1"))) {
    702                 if (!
    703                     (found_it =
    704                      set_dev_to_this_if_rx_OK(output, "/dev/dvd"))) {
    705                     if (!
    706                         (found_it =
    707                          set_dev_to_this_if_rx_OK(output, "/dev/acd0"))) {
    708                         if (!
    709                             (found_it =
    710                              set_dev_to_this_if_rx_OK(output,
    711                                                       "/dev/cd01"))) {
    712                             if (!
    713                                 (found_it =
    714                                  set_dev_to_this_if_rx_OK(output,
    715                                                           "/dev/acd1"))) {
    716                                 if (!
    717                                     (found_it =
    718                                      set_dev_to_this_if_rx_OK(output,
    719                                                               "/dev/cd1")))
    720                                 {
    721                                     retval = 1;
    722                                     goto end_of_find_cdrom_device;
     708        if (!(output = set_dev_to_this_if_rx_OK("/dev/cdrom"))) {
     709            if (!(output = set_dev_to_this_if_rx_OK("/dev/cdrom1"))) {
     710                if (!(output = set_dev_to_this_if_rx_OK("/dev/dvd"))) {
     711                    if (!(output = set_dev_to_this_if_rx_OK("/dev/acd0"))) {
     712                        if (!(output = set_dev_to_this_if_rx_OK("/dev/cd01"))) {
     713                            if (!(output = set_dev_to_this_if_rx_OK("/dev/acd1"))) {
     714                                if (!(output = set_dev_to_this_if_rx_OK("/dev/cd1"))) {
     715                                    mr_free(cdr_exe);
     716                                    return(NULL);
    723717                                }
    724718                            }
     
    732726    if (!found_it && strlen(dvd_last_resort) > 0) {
    733727        log_msg(4, "Well, I'll use the DVD - %s - as a last resort", dvd_last_resort);
    734         strcpy(output, dvd_last_resort);
     728        mr_asprintf(output, "%s", dvd_last_resort);
    735729        found_it = TRUE;
    736730    }
    737731    mr_free(dvd_last_resort);
     732
    738733    if (found_it) {
    739         sprintf(tmp, "grep \"%s=ide-scsi\" /proc/cmdline &> /dev/null",
    740                 strrchr(output, '/') + 1);
    741         if (system(tmp) == 0) {
    742             log_msg(4,
    743                     "%s is not right. It's being SCSI-emulated. Continuing.",
    744                     output);
     734        mr_asprintf(tmp1, "grep \"%s=ide-scsi\" /proc/cmdline &> /dev/null", strrchr(output, '/') + 1);
     735        if (system(tmp1) == 0) {
     736            log_msg(4, "%s is not right. It's being SCSI-emulated. Continuing.", output);
    745737            found_it = FALSE;
    746             output[0] = '\0';
    747         }
     738            mr_free(output);
     739        }
     740        mr_free(tmp1);
    748741    }
    749742
     
    753746            found_it = FALSE;
    754747            log_msg(4, "OK, I was wrong, I haven't found it... yet.");
     748            mr_free(output);
    755749        }
    756750    }
     
    758752    if (!found_it) {
    759753        log_msg(4, "OK, approach 2");
    760         if (!(found_it = set_dev_to_this_if_rx_OK(output, "/dev/scd0"))) {
    761             if (!(found_it = set_dev_to_this_if_rx_OK(output, "/dev/sr0"))) {
    762                 if (!
    763                     (found_it =
    764                      set_dev_to_this_if_rx_OK(output, "/dev/cdrom"))) {
    765                     if (!
    766                         (found_it =
    767                          set_dev_to_this_if_rx_OK(output,
    768                                                   "/dev/cdrom0"))) {
    769                         if (!
    770                             (found_it =
    771                              set_dev_to_this_if_rx_OK(output,
    772                                                       "/dev/cdrom1"))) {
    773                             if (!
    774                                 (found_it =
    775                                  set_dev_to_this_if_rx_OK(output,
    776                                                           "/dev/sr1"))) {
    777                                 if (!
    778                                     (found_it =
    779                                      set_dev_to_this_if_rx_OK(output,
    780                                                               "/dev/dvd")))
    781                                 {
    782                                     if (!
    783                                         (found_it =
    784                                          set_dev_to_this_if_rx_OK(output,
    785                                                                   g_cdrw_drive_is_here)))
    786                                     {
    787                                         retval = 1;
    788                                         goto end_of_find_cdrom_device;
     754        if (!(output = set_dev_to_this_if_rx_OK("/dev/scd0"))) {
     755            if (!(output = set_dev_to_this_if_rx_OK("/dev/sr0"))) {
     756                if (!(output = set_dev_to_this_if_rx_OK("/dev/cdrom"))) {
     757                    if (!(output = set_dev_to_this_if_rx_OK("/dev/cdrom0"))) {
     758                        if (!(output = set_dev_to_this_if_rx_OK("/dev/cdrom1"))) {
     759                            if (!(output = set_dev_to_this_if_rx_OK("/dev/sr1"))) {
     760                                if (!(output = set_dev_to_this_if_rx_OK("/dev/dvd"))) {
     761                                    if (!(output = set_dev_to_this_if_rx_OK(g_cdrw_drive_is_here))) {
     762                                        mr_free(cdr_exe);
     763                                        return(NULL);
    789764                                    }
    790765                                }
     
    802777            log_msg(4, "[Cardigans] I've changed my mind");
    803778            found_it = FALSE;
     779            mr_free(output);
    804780        } else {
    805             sprintf(tmp, "%s/archives", mountpoint);
     781            mr_asprintf(tmp1, "%s/archives", mountpoint);
    806782            if (!does_file_exist(tmp)) {
    807783                log_msg(4, "[Cardigans] I'll take it back");
    808784                found_it = FALSE;
     785                mr_free(output);
    809786            } else {
    810787                mr_asprintf(command, "umount %s", output);
     
    814791                log_msg(4, "I'm confident the Mondo CD is in %s", output);
    815792            }
     793            mr_free(tmp1);
    816794        }
    817795    }
     
    822800        if (!does_file_exist(output)) {
    823801            log_msg(3, "I still haven't found it.");
    824             return (1);
     802            mr_free(cdr_exe);
     803            mr_free(output);
     804            return (NULL);
    825805        }
    826806        log_msg(3, "(find_cdrom_device) --> '%s'", output);
    827807        strcpy(the_last_place_i_found_it, output);
    828808        strcpy(g_cdrom_drive_is_here, output);
    829         retval = 0;
    830         goto end_of_find_cdrom_device;
     809        mr_free(cdr_exe);
     810        return (output);
    831811    }
    832812
    833813    mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
     814    mr_free(cdr_exe);
     815
    834816    log_msg(1, "command=%s", command);
    835817    mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command));
    836818    mr_free(command);
    837819
     820    mr_free(output);
    838821    if (strlen(tmp1) > 0) {
    839         strcpy(output, tmp1);
     822        mr_asprintf(output, "%s", tmp1);
    840823        log_msg(4, "Finally found it at %s", output);
    841         retval = 0;
    842824    } else {
    843825        log_msg(4, "Still couldn't find it.");
    844         retval = 1;
    845826    }
    846827    mr_free(tmp1);
    847828
    848   end_of_find_cdrom_device:
    849     paranoid_free(tmp);
    850     mr_free(cdr_exe);
    851     paranoid_free(phrase_one);
    852     paranoid_free(phrase_two);
    853     return (retval);
    854 }
    855 
    856 
    857 
    858 
    859 
    860 int find_dvd_device(char *output, bool try_to_mount)
     829    return (output);
     830}
     831
     832
     833char *find_dvd_device()
    861834{
    862835    char *tmp = NULL;
    863     int retval = 0, devno = -1;
     836    int devno = -1;
     837    char *output = NULL;
    864838
    865839    if (g_dvd_drive_is_here[0]) {
    866         strcpy(output, g_dvd_drive_is_here);
     840        mr_asprintf(output, g_dvd_drive_is_here);
    867841        log_msg(3, "Been there, done that. Returning %s", output);
    868         return (0);
    869     }
    870 
    871     mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    872         );
     842        return (output);
     843    }
     844
     845    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1"));
    873846    log_msg(5, "tmp = '%s'", tmp);
    874847    if (!tmp[0])
     
    882855
    883856    if (devno >= 0) {
    884         retval = 0;
    885         sprintf(output, "/dev/scd%d", devno);
     857        mr_asprintf(output, "/dev/scd%d", devno);
    886858        strcpy(g_dvd_drive_is_here, output);
    887859        log_msg(2, "I think DVD is at %s", output);
    888860    } else {
    889861        log_msg(2, "I cannot find DVD");
    890         retval = 1;
    891     }
    892 
    893     if (try_to_mount) {
    894         log_msg(1, "Ignoring the fact that try_to_mount==TRUE");
    895     }
    896     return (retval);
     862    }
     863
     864    return (output);
    897865}
    898866
     
    10791047    /*@ end vars **************************************************** */
    10801048
     1049    if (device_raw == NULL) {
     1050        return(FALSE);
     1051    }
     1052
    10811053    malloc_string(incoming);
    1082     assert(device_raw != NULL);
    10831054    if (device_raw[0] != '/' && !strstr(device_raw, ":/")) {
    10841055        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
     
    12131184        return(1);
    12141185    }
    1215     log_msg(4, "(mount_USB_here --- device=%s, mountpoint=%s", device,
    1216             mountpoint);
     1186    log_msg(4, "(mount_USB_here --- device=%s, mountpoint=%s", device, mountpoint);
    12171187
    12181188#ifdef __FreeBSD__
     
    12371207 * @return 0 for success, nonzero for failure.
    12381208 */
    1239 int mount_CDROM_here(char *device, char *mountpoint)
     1209int mount_CDROM_here(char *device, const char *mountpoint)
    12401210{
    12411211    /*@ buffer ****************************************************** */
     
    12481218#endif
    12491219
    1250     assert_string_is_neither_NULL_nor_zerolength(device);
    12511220    assert_string_is_neither_NULL_nor_zerolength(mountpoint);
    12521221
    12531222    make_hole_for_dir(mountpoint);
    12541223
    1255     if (isdigit(device[0])) {
    1256         find_cdrom_device(device, FALSE);
     1224    if ((device == NULL) || (isdigit(device[0]))) {
     1225        mr_free(device);
     1226        device = find_cdrom_device(FALSE);
    12571227    }
    12581228#ifndef __FreeBSD__
     
    12681238            fatal_error(command);
    12691239        }
    1270         strcpy(device, dev);
    1271         paranoid_free(dev);
     1240        mr_free(device);
     1241        device = dev;
    12721242#else
    12731243        mr_strcat(options, ",loop");
     
    12751245
    12761246    }
    1277     log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device,
    1278             mountpoint);
     1247    log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device, mountpoint);
    12791248    /*@ end vars *************************************************** */
    12801249
     
    12931262    retval = system(command);
    12941263    log_msg(1, "system(%s) returned %d", command, retval);
    1295     paranoid_free(command);
     1264    mr_free(command);
    12961265
    12971266    return (retval);
     
    13241293    /*@ buffers ********************************************************* */
    13251294    char *tmp = NULL;
    1326     char *p = NULL;
    13271295    char *mds = NULL;
    13281296    char *request = NULL;
     
    13421310    mr_free(tmp);
    13431311
    1344     if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso
    1345         || bkpinfo->backup_media_type == nfs) {
     1312    if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso || bkpinfo->backup_media_type == nfs) {
     1313        // BERLIOS --- I'm tempted to do something about this...
     1314        // Why unmount and remount again and again?
    13461315        log_msg(3, "Remounting CD");
    13471316        g_ISO_restore_mode = TRUE;
    1348         // FIXME --- I'm tempted to do something about this...
    1349         // Why unmount and remount again and again?
    13501317        if (is_this_device_mounted(MNT_CDROM)) {
    13511318            run_program_and_log_output("umount " MNT_CDROM, 5);
     
    13551322        mr_free(tmp);
    13561323
    1357         mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1324        if (((bkpinfo->isodir == NULL) && (bkpinfo->nfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
     1325            fatal_error("Unable to prepare ISO file name. Please report to dev team");
     1326        }
     1327        if (bkpinfo->nfs_remote_dir) {
     1328            // NFS
     1329            mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1330        } else {
     1331            // ISO
     1332            mr_asprintf(tmp, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, cd_number_i_want);
     1333        }
    13581334        if (!does_file_exist(tmp)) {
    13591335            mr_free(tmp);
    1360             mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1336            if (bkpinfo->nfs_remote_dir) {
     1337                // NFS
     1338                mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1339            } else {
     1340                // ISO
     1341                mr_asprintf(tmp, "%s/isodir/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->prefix, cd_number_i_want);
     1342            }
    13611343            if (does_file_exist(tmp)) {
    13621344                log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir);
     
    13731355    }
    13741356    if ((res = what_number_cd_is_this()) != cd_number_i_want) {
    1375         log_msg(3, "Currently, we hold %d but we want %d", res,
    1376                 cd_number_i_want);
     1357        log_msg(3, "Currently, we hold %d but we want %d", res, cd_number_i_want);
    13771358        mds = media_descriptor_string(bkpinfo->backup_media_type);
    13781359        log_msg(3, "Insisting on %s #%d", mds, cd_number_i_want);
     
    14901471            mds = media_descriptor_string(bkpinfo->backup_media_type);
    14911472            mr_asprintf(comment, "What speed is your %s (re)writer?", mds);
     1473            mr_free(bkpinfo->media_device);
    14921474            if (bkpinfo->backup_media_type == dvd) {
    1493                 find_dvd_device(bkpinfo->media_device, FALSE);
     1475                bkpinfo->media_device = find_dvd_device();
    14941476                mr_asprintf(tmp, "1");
    14951477                mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE);  // 4.7 salesman's GB = 4.482 real GB = 4482 MB
    14961478                log_msg(1, "Setting to DVD defaults");
    14971479            } else {
    1498                 strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM);
     1480                mr_asprintf(bkpinfo->media_device, "%s", VANILLA_SCSI_CDROM);
    14991481                mr_asprintf(tmp, "4");
    15001482                mr_asprintf(sz_size, "%d", 650);
     
    15421524        mds = media_descriptor_string(bkpinfo->backup_media_type);
    15431525
     1526        mr_free(bkpinfo->media_device);
    15441527        if ((bkpinfo->disaster_recovery) && (bkpinfo->backup_media_type != usb)) {
    1545             strcpy(bkpinfo->media_device, "/dev/cdrom");
    1546             log_msg(2, "CD-ROM device assumed to be at %s",
    1547                     bkpinfo->media_device);
    1548         } else if ((bkpinfo->restore_data && (bkpinfo->backup_media_type != usb))
    1549                    || bkpinfo->backup_media_type == dvd) {
    1550             if (!bkpinfo->media_device[0]) {
    1551                 strcpy(bkpinfo->media_device, "/dev/cdrom");
    1552             }                   // just for the heck of it :)
    1553             log_msg(1, "bkpinfo->media_device = %s",
    1554                     bkpinfo->media_device);
    1555             if (bkpinfo->backup_media_type == dvd
    1556                 || find_cdrom_device(bkpinfo->media_device, FALSE)) {
    1557                 log_msg(1, "bkpinfo->media_device = %s",
    1558                         bkpinfo->media_device);
     1528            mr_asprintf(bkpinfo->media_device, "/dev/cdrom");
     1529            log_msg(2, "CD-ROM device assumed to be at %s", bkpinfo->media_device);
     1530        } else if ((bkpinfo->restore_data && (bkpinfo->backup_media_type != usb)) || bkpinfo->backup_media_type == dvd) {
     1531            if ((bkpinfo->backup_media_type == dvd) || ((bkpinfo->media_device = find_cdrom_device(FALSE)) != NULL)) {
    15591532                mr_asprintf(comment, "Please specify your %s drive's /dev entry", mds);
    15601533                p = popup_and_get_string("Device?", comment, bkpinfo->media_device);
     
    15651538                    finish(1);
    15661539                }
    1567                 strcpy(bkpinfo->media_device, p);
    1568                 mr_free(p);
    1569             }
    1570             log_msg(2, "%s device found at %s", mds, bkpinfo->media_device);
     1540                mr_free(bkpinfo->media_device);
     1541                bkpinfo->media_device = p;
     1542            }
     1543            if (bkpinfo->media_device != NULL) {
     1544                log_msg(2, "%s device found at %s", mds, bkpinfo->media_device);
     1545            } else {
     1546                log_msg(2, "%s device not found (bkpinfo->media_device is NULL)", mds);
     1547            }
    15711548        } else {
    1572             if ((find_cdrw_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {
    1573                 bkpinfo->media_device[0] = '\0';
    1574             }
    1575             if (bkpinfo->media_device[0]) {
     1549            if (((bkpinfo->media_device = find_cdrw_device()) != NULL) && (bkpinfo->backup_media_type != usb)) {
     1550                mr_free(bkpinfo->media_device);
     1551            }
     1552            if (bkpinfo->media_device != NULL) {
    15761553                if (bkpinfo->backup_media_type == usb) {
    15771554                    mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
     
    15801557                }
    15811558                if (!ask_me_yes_or_no(tmp)) {
    1582                     bkpinfo->media_device[0] = '\0';
     1559                    mr_free(bkpinfo->media_device);
    15831560                }
    15841561                mr_free(tmp);
    15851562            }
    1586             if (!bkpinfo->media_device[0]) {
     1563            if (!bkpinfo->media_device) {
    15871564                if (bkpinfo->backup_media_type == usb) {
    1588                     p = popup_and_get_string("/dev entry?", "What is the /dev entry of your USB Disk/Key, please?", bkpinfo->media_device);
     1565                    p = popup_and_get_string("/dev entry?", "What is the /dev entry of your USB Disk/Key, please?", NULL);
    15891566                } else {
    15901567                    if (g_kernel_version < 2.6) {
    1591                         p = popup_and_get_string("Device node?", "What is the SCSI node of your CD (re)writer, please?", bkpinfo->media_device);
     1568                        p = popup_and_get_string("Device node?", "What is the SCSI node of your CD (re)writer, please?", NULL);
    15921569                    } else {
    1593                         p = popup_and_get_string("/dev entry?", "What is the /dev entry of your CD (re)writer, please?", bkpinfo->media_device);
     1570                        p = popup_and_get_string("/dev entry?", "What is the /dev entry of your CD (re)writer, please?", NULL);
    15941571                    }
    15951572                }
     
    15981575                    finish(1);
    15991576                }
    1600                 strcpy(bkpinfo->media_device, p);
    1601                 mr_free(p);
     1577                bkpinfo->media_device = p;
    16021578            }
    16031579        }
     
    16181594    case tape:
    16191595
    1620         if ((!bkpinfo->restore_mode) && (!mr_find_tape_device())) {
     1596        mr_free(bkpinfo->media_device);
     1597        if ((!bkpinfo->restore_mode) && ((bkpinfo->media_device = find_tape_device_and_size(NULL)) == NULL)) {
    16211598            log_msg(3, "Ok, using vanilla scsi tape.");
    1622             strcpy(bkpinfo->media_device, VANILLA_SCSI_TAPE);
     1599            mr_asprintf(bkpinfo->media_device, "%s", VANILLA_SCSI_TAPE);
    16231600            if ((fin = fopen(bkpinfo->media_device, "r"))) {
    16241601                paranoid_fclose(fin);
    16251602            } else {
    1626                 strcpy(bkpinfo->media_device, "/dev/osst0");
    1627             }
    1628         }
    1629         if (bkpinfo->media_device[0]) {
     1603                mr_free(bkpinfo->media_device);
     1604                mr_asprintf(bkpinfo->media_device, "/dev/osst0");
     1605            }
     1606        }
     1607        if (bkpinfo->media_device != NULL) {
    16301608            if ((fin = fopen(bkpinfo->media_device, "r"))) {
    16311609                paranoid_fclose(fin);
    16321610            } else {
    16331611                if (does_file_exist("/tmp/mondo-restore.cfg")) {
    1634                     read_cfg_var("/tmp/mondo-restore.cfg", "media-dev",
    1635                                  bkpinfo->media_device);
     1612                    mr_free(bkpinfo->media_device);
     1613                    bkpinfo->media_device = read_cfg_var("/tmp/mondo-restore.cfg", "media-dev");
    16361614                }
    16371615            }
    16381616        }
    1639         if (bkpinfo->media_device[0]) {
     1617        if (bkpinfo->media_device != NULL) {
    16401618            mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16411619            if (!ask_me_yes_or_no(tmp)) {
    1642                 bkpinfo->media_device[0] = '\0';
     1620                mr_free(bkpinfo->media_device);
    16431621            }
    16441622            mr_free(tmp);
    16451623        }
    1646         if (!bkpinfo->media_device[0]) {
     1624        if (bkpinfo->media_device == NULL) {
    16471625            p = popup_and_get_string("Device name?", "What is the /dev entry of your tape streamer?", bkpinfo->media_device);
    16481626            if (p == NULL) {
     
    16501628                finish(1);
    16511629            }
    1652             strcpy(bkpinfo->media_device, p);
    1653             mr_free(p);
     1630            bkpinfo->media_device = p;
    16541631        }
    16551632        mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device);
     
    16861663
    16871664        /* Initiate bkpinfo nfs_mount path from running environment if not already done */
    1688         if (!bkpinfo->nfs_mount[0]) {
    1689             strcpy(bkpinfo->nfs_mount,
    1690                    call_program_and_get_last_line_of_output
    1691                    ("mount | grep \":\" | cut -d' ' -f1 | head -n1"));
     1665        if (bkpinfo->nfs_mount == NULL) {
     1666            mr_asprintf(bkpinfo->nfs_mount, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f1 | head -n1"));
    16921667        }
    16931668#ifdef __FreeBSD__
     
    17021677                finish(1);
    17031678            }
    1704             strcpy(bkpinfo->nfs_mount, p);
    1705             mr_free(p);
     1679            mr_free(bkpinfo->nfs_mount);
     1680            bkpinfo->nfs_mount = p;
    17061681            if (!bkpinfo->restore_data) {
    17071682                if ((bkpinfo->compression_level =
     
    17131688            // check whether already mounted - we better remove
    17141689            // surrounding spaces and trailing '/' for this
    1715             strip_spaces(bkpinfo->nfs_mount);
     1690            mr_strip_spaces(bkpinfo->nfs_mount);
    17161691            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    17171692                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
     
    17521727                finish(1);
    17531728            }
    1754             strcpy(bkpinfo->nfs_mount, p);
    1755             mr_free(p);
     1729            mr_free(bkpinfo->nfs_mount);
     1730            bkpinfo->nfs_mount = p;
    17561731        }
    17571732        /* Initiate bkpinfo isodir path from running environment if mount already done */
     
    17821757            finish(1);
    17831758        }
    1784         strcpy(bkpinfo->nfs_remote_dir, p);
    1785         mr_free(p);
     1759        mr_free(bkpinfo->nfs_remote_dir);
     1760        bkpinfo->nfs_remote_dir = p;
    17861761
    17871762        // check whether writable - we better remove surrounding spaces for this
    1788         strip_spaces(bkpinfo->nfs_remote_dir);
     1763        mr_strip_spaces(bkpinfo->nfs_remote_dir);
    17891764
    17901765        p = popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix);
     
    19981973    }
    19991974    log_it("isodir = %s", bkpinfo->isodir);
    2000     log_it("nfs_mount = '%s'", bkpinfo->nfs_mount);
     1975    if (bkpinfo->nfs_mount) {
     1976        log_it("nfs_mount = '%s'", bkpinfo->nfs_mount);
     1977    }
    20011978    if (bkpinfo->nfs_user) {
    20021979        log_it("nfs_user = '%s'", bkpinfo->nfs_user);
     
    21352112        fatal_error("I couldn't figure out the scratchdir!");
    21362113    }
     2114
     2115    /* Cleaning a potential previous scratchdir */
     2116    if (bkpinfo->scratchdir) {
     2117        mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir);
     2118        paranoid_system(command);
     2119        mr_free(command);
     2120    }
    21372121    mr_free(bkpinfo->scratchdir);
     2122
    21382123    mr_asprintf(bkpinfo->scratchdir , "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
    21392124    log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);
    21402125
     2126    /* Cleaning potential previous scratchdir */
    21412127    mr_asprintf(command, "rm -Rf %s/mondo.scratch.*", tmp);
    21422128    mr_free(tmp);
     
    21562142 */
    21572143/**
    2158  * If we can read @p dev, set @p output to it.
    2159  * If @p dev cannot be read, set @p output to "".
     2144 * If we can read @p dev, set @return output to it.
     2145 * If @p dev cannot be read, set @p output to NULL.
    21602146 * @param dev The device to check for.
    2161  * @param output Set to @p dev if @p dev exists, "" otherwise.
    2162  * @return TRUE if @p dev exists, FALSE if it doesn't.
    2163  */
    2164 bool set_dev_to_this_if_rx_OK(char *output, char *dev)
     2147 * @return output Set to @p dev if @p dev exists, NULL otherwise.
     2148 */
     2149char *set_dev_to_this_if_rx_OK(char *dev)
    21652150{
    21662151    char *command = NULL;
    2167     bool res;
     2152    char *output = NULL;
    21682153
    21692154    if (!dev || dev[0] == '\0') {
    2170         output[0] = '\0';
    2171         return (FALSE);
     2155        return(NULL);
    21722156    }
    21732157    log_msg(10, "Injecting %s", dev);
     
    21752159    if (!does_file_exist(dev)) {
    21762160        log_msg(10, "%s doesn't exist. Returning FALSE.", dev);
    2177         return (FALSE);
     2161        return(NULL);
    21782162    }
    21792163    mr_asprintf(command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev);
    21802164    if (!run_program_and_log_output(command, FALSE)
    21812165        && !run_program_and_log_output(command, FALSE)) {
    2182         strcpy(output, dev);
     2166        mr_asprintf(output, "%s", dev);
    21832167        log_msg(4, "Found it - %s", dev);
    2184         res = TRUE;
    21852168    } else {
    2186         output[0] = '\0';
    21872169        log_msg(4, "It's not %s", dev);
    2188         res = FALSE;
    21892170    }
    21902171    mr_free(command);
    2191     return(res);
     2172    return(output);
    21922173}
    21932174
     
    22212202    }
    22222203
    2223     mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    2224     if (!mountdev[0]) {
     2204    if (bkpinfo->media_device) {
     2205        mr_asprintf(mountdev, "%s", bkpinfo->media_device);
     2206    }
     2207    if (!mountdev) {
    22252208        log_it("(what_number_cd_is_this) Warning - media_device unknown. Finding out...");
    2226         find_cdrom_device(bkpinfo->media_device, FALSE);
     2209        mr_free(bkpinfo->media_device);
     2210        bkpinfo->media_device = find_cdrom_device(FALSE);
     2211        mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    22272212    }
    22282213    if (!is_this_device_mounted(MNT_CDROM)) {
  • branches/2.2.10/mondo/src/common/libmondo-devices.h

    r2321 r2325  
    88bool does_string_exist_in_boot_block(char *dev, char *str);
    99int find_and_mount_actual_cd(char *mountpoint);
    10 int find_cdrom_device(char *output, bool try_to_mount);
    11 int find_dvd_device(char *output, bool try_to_mount);
     10char *find_cdrom_device(bool try_to_mount);
     11char *find_dvd_device();
    1212long get_phys_size_of_drive(char *drive);
    1313bool is_this_a_valid_disk_format(char *format);
    14 int mount_CDROM_here(char *device, char *mountpoint);
     14int mount_CDROM_here(char *device, const char *mountpoint);
    1515int find_device_in_mountlist(struct mountlist_itself *mountlist,
    1616                             char *device);
     
    2323
    2424
    25 int find_cdrw_device(char *cdrw_device);
     25char *find_cdrw_device();
    2626
    2727int interactively_obtain_media_parameters_from_user(bool);
     
    4444
    4545
    46 bool set_dev_to_this_if_rx_OK(char *output, char *dev);
     46char *set_dev_to_this_if_rx_OK(char *dev);
    4747
    4848
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2324 r2325  
    693693/**
    694694 * Get the number of the last fileset in the backup.
    695  * @param bkpinfo The backup information structure. Only the @c bkpinfo->tmpdir field is used.
    696695 * @return The last filelist number.
    697696 * @note This function should only be called at restore-time.
     
    700699{
    701700    /*@ buffers ***************************************************** */
    702     char val_sz[MAX_STR_LEN];
     701    char *val_sz = NULL;
    703702    char *cfg_fname = NULL;
    704703
     
    710709    assert(bkpinfo != NULL);
    711710
    712     strcpy(val_sz,"");
    713711    mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
    714     read_cfg_var(cfg_fname, "last-filelist-number", val_sz);
     712    val_sz = read_cfg_var(cfg_fname, "last-filelist-number");
    715713    mr_free(cfg_fname);
    716714
     715    if (val_sz == NULL) {
     716        mr_asprintf(val_sz, "");
     717    }
    717718    val_i = atoi(val_sz);
     719    mr_free(val_sz);
     720
    718721    if (val_i <= 0) {
    719722        val_i = 500;
  • branches/2.2.10/mondo/src/common/libmondo-files-EXT.h

    r2053 r2325  
    4242
    4343
    44 extern int make_hole_for_dir(char *outdir_fname);
     44extern int make_hole_for_dir(const char *outdir_fname);
    4545
    4646extern long size_of_partition_in_mountlist_K(char *tmpdir, char *dev);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2324 r2325  
    622622 * @return The return value of @c mkdir.
    623623 */
    624 int make_hole_for_dir(char *outdir_fname)
     624int make_hole_for_dir(const char *outdir_fname)
    625625{
    626626    char *tmp = NULL;
     
    10971097    char *p;
    10981098
     1099    if (! bkpinfo->nfs_mount) {
     1100        fatal_error("No nfs_mount found !");
     1101    }
     1102
    10991103    log_it("Storing NFS configuration");
    11001104    mr_asprintf(tmp, "%s", bkpinfo->nfs_mount);
  • branches/2.2.10/mondo/src/common/libmondo-files.h

    r2053 r2325  
    4444
    4545
    46 int make_hole_for_dir(char *outdir_fname);
     46int make_hole_for_dir(const char *outdir_fname);
    4747long size_of_partition_in_mountlist_K(char *tmpdir, char *dev);
    4848int make_grub_install_scriptlet(char *outfile);
  • branches/2.2.10/mondo/src/common/libmondo-fork.c

    r2324 r2325  
    355355    char *command = NULL;
    356356    char *lockfile = NULL;
    357     char tmp1[MAX_STR_LEN *2];
    358357
    359358    /*@ end vars *************************************************** */
  • branches/2.2.10/mondo/src/common/libmondo-stream-EXT.h

    r2321 r2325  
    55extern int closein_tape();
    66extern int closeout_tape();
    7 extern char *mr_find_tape_device(void);
     7extern char *find_tape_device_and_size(char *siz);
    88extern void insist_on_this_tape_number(int tapeno);
    99extern void log_tape_pos(void);
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2324 r2325  
    138138    paranoid_pclose(g_tape_stream);
    139139    log_it("closein_tape() -- leaving");
    140 /*
    141   for(i=0; i < g_tapecatalog->entries; i++)
    142     {
    143       log_it("i=%d type=%s num=%d aux=%ld", i, (g_tapecatalog->el[i].type==fileset)?"fileset":"bigslice", g_tapecatalog->el[i].number, g_tapecatalog->el[i].aux);
    144     }
    145 */
    146140    if (!bkpinfo->please_dont_eject) {
    147141        eject_device(bkpinfo->media_device);
     
    222216               g_tapecatalog->el[i].tape_posK);
    223217    }
    224     //  if (!bkpinfo->please_dont_eject)
    225     //    { eject_device(bkpinfo->media_device); }
    226218    paranoid_free(blk);
    227219    paranoid_free(g_tapecatalog);
     
    261253    char *dev = NULL;
    262254    int res;
     255    char *dev = NULL;
    263256
    264257    log_to_screen("I am looking for your tape streamer. Please wait.");
     
    296289    mr_free(command);
    297290
    298     mr_asprintf(&dev, "%s", VANILLA_SCSI_TAPE);
    299     dev[strlen(dev) - 1] = '\0';
     291
     292    mr_asprintf(dev, "%s", "/dev/st");
    300293    mr_strcat(dev, tmp);            // e.g. '/dev/st0' becomes '/dev/stN'
    301294    mr_free(tmp);
    302 
    303295    res = 0;
    304296    if (!mt_says_tape_exists(dev)) {
     
    314306                mr_asprintf(&dev, "/dev/osst0");
    315307                if (!mt_says_tape_exists(dev)) {
     308                    mr_free(dev);
    316309                    res++;
    317310                } else {
     
    322315    }
    323316
    324     log_it("At this point, dev = %s and res = %d", dev, res);
     317    if (dev) {
     318        log_it("At this point, dev = %s and res = %d", dev, res);
     319    } else {
     320        log_it("At this point, dev is NULL and res = %d", dev, res);
     321    }
    325322
    326323    mr_asprintf(&tmp, call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'"));
     
    338335            res = 0;
    339336        } else {
     337            mr_free(dev);
    340338            res++;
    341339        }
     
    610608    int res;
    611609
     610    if (bkpinfo->media_device == NULL) {
     611        return(1);
     612    }
     613
    612614    if (strncmp(bkpinfo->media_device, "/dev/", 5)) {
    613         log_msg(1,
    614                 "Not using 'mt setblk'. This isn't an actual /dev entry.");
     615        log_msg(1, "Not using 'mt setblk'. This isn't an actual /dev entry.");
    615616        return (0);
    616617    }
     
    683684    int res = 0;
    684685
     686    if (bkpinfo->media_device == NULL) {
     687        return(1);
     688    }
     689
    685690    log_it("Skipping OBDR headers");
    686691    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
     
    708713    char *command = NULL;
    709714    int res = 0;
     715
     716    if (bkpinfo->media_device == NULL) {
     717        return(1);
     718    }
    710719
    711720    log_it("Creating OBDR headers");
     
    770779    /*@ end vars *************************************************** */
    771780
    772     assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device);
    773     if (!(g_tapecatalog = malloc(sizeof(struct s_tapecatalog)))) {
    774         fatal_error("Cannot alloc mem for tape catalog");
    775     }
     781    g_tapecatalog = mr_malloc(sizeof(struct s_tapecatalog));
    776782    g_tapecatalog->entries = 0;
    777783    g_tape_posK = 0;
     
    790796        if (bkpinfo->media_device == NULL) {
    791797            log_it("Not able to skip OBDR - Restore will have to be done manually");
     798            return (1);
    792799        }
    793800        set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     
    798805    make_hole_for_file(outfname);
    799806
    800 //  start_buffer_process( bkpinfo->media_device, g_tape_fifo, FALSE);
    801807    log_it("Opening IN tape");
    802     if (!
    803         (g_tape_stream =
    804          open_device_via_buffer(bkpinfo->media_device, 'r',
    805                                 bkpinfo->internal_tape_block_size))) {
     808    if (!(g_tape_stream = open_device_via_buffer(bkpinfo->media_device, 'r', bkpinfo->internal_tape_block_size))) {
    806809        log_OS_error(g_tape_fifo);
    807810        log_to_screen("Cannot openin stream device");
     
    884887    /*@ end vars *************************************************** */
    885888
     889    if (cddev == NULL) {
     890        log_to_screen("Failed to openout NULL cddev");
     891        return (1);
     892    }
    886893    /*  add 'dummy' if testing */
    887894    mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
     
    923930    return (0);
    924931}
    925 if (!(g_tapecatalog = malloc(sizeof(struct s_tapecatalog)))) {
    926     fatal_error("Cannot alloc mem for tape catalog");
    927 }
     932if (bkpinfo->media_device == NULL) {
     933    log_it("Unable to openout NULL dvice");
     934    return(1);
     935}
     936g_tapecatalog = mr_malloc(sizeof(struct s_tapecatalog));
    928937g_tapecatalog->entries = 0;
    929938g_tape_posK = 0;
     
    935944}
    936945log_it("Opening OUT tape");
    937 if (!
    938     (g_tape_stream =
    939      open_device_via_buffer(bkpinfo->media_device, 'w', bkpinfo->internal_tape_block_size))) {
     946if (!(g_tape_stream = open_device_via_buffer(bkpinfo->media_device, 'w', bkpinfo->internal_tape_block_size))) {
    940947    log_OS_error(g_tape_fifo);
    941948    log_to_screen("Cannot openin stream device");
     
    950957/**
    951958 * Copy a file from the opened stream (CD or tape) to @p outfile.
    952  * @param bkpinfo The backup information structure. @c bkpinfo->media_device is the only field used.
    953959 * @param outfile The file to write to.
    954960 * @param size The size of the file in the input stream.
     
    14221428    /*@ end vars *************************************************** */
    14231429
     1430    if (bkpinfo->media_device == NULL) {
     1431        log_it("Unable to open in from NULL device");
     1432        return (1);
     1433    }
     1434
    14241435    paranoid_pclose(g_tape_stream);
    14251436    sync();
     
    14291440    insist_on_this_tape_number(g_current_media_number + 1); // will increment it, too
    14301441    log_it("Opening IN the next tape");
    1431     if (!
    1432         (g_tape_stream =
    1433          open_device_via_buffer(bkpinfo->media_device, 'r',
    1434                                 bkpinfo->internal_tape_block_size))) {
     1442    if (!(g_tape_stream = open_device_via_buffer(bkpinfo->media_device, 'r', bkpinfo->internal_tape_block_size))) {
    14351443        log_OS_error(g_tape_fifo);
    14361444        log_to_screen("Cannot openin stream device");
     
    14641472    int res = 0;
    14651473    char *command = NULL;
     1474
     1475    if (bkpinfo->media_device == NULL) {
     1476        log_it("Unable to open out from NULL device");
     1477        return (1);
     1478    }
    14661479
    14671480    paranoid_pclose(g_tape_stream);
     
    14891502    } else {
    14901503        log_it("Opening OUT to next tape");
    1491         if (!
    1492             (g_tape_stream =
    1493              open_device_via_buffer(bkpinfo->media_device, 'w',
    1494                                     bkpinfo->internal_tape_block_size))) {
     1504        if (!(g_tape_stream = open_device_via_buffer(bkpinfo->media_device, 'w', bkpinfo->internal_tape_block_size))) {
    14951505            log_OS_error(g_tape_fifo);
    14961506            log_to_screen("Cannot openin stream device");
  • branches/2.2.10/mondo/src/common/libmondo-stream.h

    r2321 r2325  
    77int closein_tape();
    88int closeout_tape();
    9 char *mr_find_tape_device(void);
     9char *find_tape_device_and_size(char *siz);
    1010void insist_on_this_tape_number(int tapeno);
    1111void log_tape_pos(void);
  • branches/2.2.10/mondo/src/common/libmondo-tools-EXT.h

    r2321 r2325  
    1010                                   const char *szFunction, int nLine,
    1111                                   const char *fmt, ...);
    12 extern int read_cfg_var(char *config_file, char *label, char *value);
     12extern char *read_cfg_var(char *config_file, char *label);
    1313extern int write_cfg_var(char *config_file, char *label, char *value);
    1414extern void init_bkpinfo();
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2324 r2325  
    419419    char *p = NULL;
    420420    char call_before_iso_user[MAX_STR_LEN] = "\0";
    421     /*
    422     long avm = 0;
    423     int rdsiz_MB;
    424     */
    425421    char *iso_dev = NULL;
    426422    char *iso_mnt = NULL;
     
    449445    if (bkpinfo->backup_media_type == tape) {
    450446        log_msg(1, "Bar");
     447        if (bkpinfo->media_device == NULL) {
     448            return(1);
     449        }
    451450        mr_asprintf(tmp, "mt -f %s status", bkpinfo->media_device);
    452451        log_msg(1, "tmp = '%s'", tmp);
     
    526525            // -m isn't supported by growisofs, BTW...
    527526        } else {
     527            if (bkpinfo->media_device == NULL) {
     528                return(1);
     529            }
    528530            sprintf(bkpinfo->call_make_iso,
    529531                    "%s %s -Z %s . 2>> _ERR_",
     
    594596            }
    595597            log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso);
     598            if (bkpinfo->media_device == NULL) {
     599                return(1);
     600            }
    596601            sprintf(bkpinfo->call_make_iso,
    597602                    "%s %s -v %s fs=4m dev=%s speed=%d %s/"MONDO_TMPISOS,
     
    667672
    668673    if (bkpinfo->backup_media_type == nfs) {
    669         strcpy(hostname, bkpinfo->nfs_mount);
     674        if (bkpinfo->nfs_mount) {
     675            strcpy(hostname, bkpinfo->nfs_mount);
     676        } else {
     677            log_it("nfs_mount is NULL");
     678            retval++;
     679            strcpy(hostname, "");
     680        }
    670681        colon = strchr(hostname, ':');
    671682        if (!colon) {
     
    678689            hent = gethostbyname(hostname);
    679690            if (!hent) {
    680                 log_it("Can't resolve NFS mount (%s): %s", hostname,
    681                        hstrerror(h_errno));
     691                log_it("Can't resolve NFS mount (%s): %s", hostname, hstrerror(h_errno));
    682692                retval++;
    683693            } else {
    684694                mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    685695                mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':'));
    686                 strcpy(bkpinfo->nfs_mount, ip_address);
    687                 paranoid_free(ip_address);
     696                mr_free(bkpinfo->nfs_mount);
     697                bkpinfo->nfs_mount = ip_address;
    688698            }
    689699        }
     
    746756    }
    747757    g_current_media_number = 1;
    748     bkpinfo->postnuke_tarball[0] = bkpinfo->nfs_mount[0] = '\0';
     758    bkpinfo->postnuke_tarball[0] = '\0';
    749759    return (res);
    750760}
     
    787797void mr_free_bkpinfo() {
    788798
     799    mr_free(bkpinfo->media_device);
     800    mr_free(bkpinfo->isodir);
     801    mr_free(bkpinfo->prefix);
    789802    mr_free(bkpinfo->scratchdir);
    790803    mr_free(bkpinfo->tmpdir);
    791804    mr_free(bkpinfo->include_paths);
    792805    mr_free(bkpinfo->exclude_paths);
     806    mr_free(bkpinfo->nfs_mount);
     807    mr_free(bkpinfo->nfs_remote_dir);
    793808    mr_free(bkpinfo->nfs_user);
    794809
     
    804819{
    805820    int i;
    806     char *p = NULL;
    807 
    808821    log_msg(1, "Hi");
    809822
    810823    /* Initialized in same order as in the structure declaration to detect errors more easily */
    811     bkpinfo->media_device[0] = '\0';
     824    bkpinfo->media_device = NULL;
    812825    for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
    813826        bkpinfo->media_size[i] = -1;
     
    846859    bkpinfo->call_after_iso[0] = '\0';
    847860    bkpinfo->kernel_path[0] = '\0';
    848     bkpinfo->nfs_mount[0] = '\0';
    849     bkpinfo->nfs_remote_dir[0] = '\0';
     861    bkpinfo->nfs_mount = NULL;
     862    bkpinfo->nfs_remote_dir = NULL;
    850863    bkpinfo->nfs_user = NULL;
    851864    bkpinfo->postnuke_tarball[0] = '\0';
     
    10721085 * @return 0 for success, 1 for failure.
    10731086 */
    1074 int read_cfg_var(char *config_file, char *label, char *value)
     1087char *read_cfg_var(char *config_file, char *label)
    10751088{
    10761089    /*@ buffer ****************************************************** */
    10771090    char *command = NULL;
     1091    char *value = NULL;
    10781092
    10791093    /*@ end vars *************************************************** */
     
    10831097    if (!does_file_exist(config_file)) {
    10841098        log_to_screen("(read_cfg_var) Cannot find %s config file", config_file);
    1085         value[0] = '\0';
    1086         return (1);
     1099        return (NULL);
     1100        /* BERLIOS: not sure the sage of this one ?
    10871101    } else if ((value != NULL) && (strstr(value, "/dev/") && strstr(value, "t0") && !strcmp(label, "media-dev"))) {
    10881102        log_msg(2, "FYI, I can't read new value for %s - already got %s", label, value);
    10891103        return (0);
     1104        */
    10901105    } else {
    10911106        mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
    1092         strcpy(value, call_program_and_get_last_line_of_output(command));
     1107        mr_asprintf(value, "%s", call_program_and_get_last_line_of_output(command));
    10931108        mr_free(command);
    10941109
    10951110        if (strlen(value) == 0) {
    1096             return (1);
     1111            return (NULL);
    10971112        } else {
    1098             return (0);
     1113            return (value);
    10991114        }
    11001115    }
  • branches/2.2.10/mondo/src/common/libmondo-tools.h

    r2321 r2325  
    1313                            const char *szFunction, int nLine,
    1414                            const char *fmt, ...);
    15 int read_cfg_var(char *config_file, char *label, char *value);
     15char *read_cfg_var(char *config_file, char *label);
    1616int write_cfg_var(char *config_file, char *label, char *value);
    1717void init_bkpinfo();
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2324 r2325  
    924924    assert(bkpinfo != NULL);
    925925
     926    if (bkpinfo->media_device == NULL) {
     927        return(1);
     928    }
     929
    926930    mr_asprintf(fname, "%s1", bkpinfo->media_device);
    927931    if (is_this_device_mounted(fname)) {
     
    10221026    assert(bkpinfo != NULL);
    10231027
     1028    if (bkpinfo->media_device == NULL) {
     1029        return(1);
     1030    }
     1031
    10241032    mr_asprintf(mountpoint, "%s/cdrom", bkpinfo->tmpdir);
    1025     mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     1033    if (((bkpinfo->isodir == NULL) && (bkpinfo->nfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) {
     1034        fatal_error("No iso filename preparation possible");
     1035    }
     1036    if (bkpinfo->nfs_remote_dir) {
     1037        // NFS
     1038        mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     1039    } else {
     1040        // ISO
     1041        mr_asprintf(fname, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);
     1042    }
    10261043
    10271044    mkdir(mountpoint, 1777);
     
    11061123        mr_free(command);
    11071124
    1108         if (!bkpinfo->please_dont_eject
    1109             && eject_device(bkpinfo->media_device)) {
     1125        if (!bkpinfo->please_dont_eject && eject_device(bkpinfo->media_device)) {
    11101126            log_msg(2, "Failed to eject CD-ROM drive");
    11111127        }
  • branches/2.2.10/mondo/src/common/libmondo-verify.h

    r2316 r2325  
    2828extern void fatal_error(char *);
    2929extern int find_and_mount_actual_cd(char *);
    30 extern int find_cdrom_device(char *, bool);
     30extern char *find_cdrom_device(bool);
    3131extern void finish(int);
    3232extern int get_last_filelist_number();
  • branches/2.2.10/mondo/src/common/mondostructures.h

    r2323 r2325  
    339339   * If backup_media_type is anything else, this should be blank.
    340340   */
    341     char media_device[MAX_STR_LEN / 4];
     341    char *media_device;
    342342
    343343  /**
     
    553553   * address form. (Domain names will be resolved in post_param_configuration().)
    554554   */
    555     char nfs_mount[MAX_STR_LEN];
     555    char *nfs_mount;
    556556
    557557  /**
     
    559559   * the backups in.
    560560   */
    561     char nfs_remote_dir[MAX_STR_LEN];
     561    char *nfs_remote_dir;
    562562
    563563  /**
  • branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c

    r2324 r2325  
    276276    if (argc > 2 && !strcmp(argv[1], "find-cd")) {
    277277        g_loglevel = 10;
    278         malloc_string(tmp);
    279         if (find_cdrw_device(tmp)) {
     278        if ((tmp = find_cdrw_device()) == NULL) {
    280279            printf("Failed to find CDR-RW drive\n");
    281280        } else {
    282281            printf("CD-RW is at %s\n", tmp);
    283282        }
    284         tmp[0] = '\0';
    285         if (find_cdrom_device(tmp, atoi(argv[2]))) {
     283        mr_free(tmp);
     284        if ((tmp = find_cdrom_device(FALSE)) == NULL) {
    286285            printf("Failed to find CD-ROM drive\n");
    287286        } else {
    288287            printf("CD-ROM is at %s\n", tmp);
    289288        }
    290         paranoid_free(tmp);
     289        mr_free(tmp);
    291290        finish(0);
    292291    }
     
    294293    if (argc > 2 && !strcmp(argv[1], "find-dvd")) {
    295294        g_loglevel = 10;
    296         malloc_string(tmp);
    297         if (find_dvd_device(tmp, atoi(argv[2]))) {
     295        if ((tmp = find_dvd_device()) == NULL) {
    298296            printf("Failed to find DVD drive\n");
    299297        } else {
    300298            printf("DVD is at %s\n", tmp);
    301299        }
    302         paranoid_free(tmp);
     300        mr_free(tmp);
    303301        finish(0);
    304302    }
     
    406404    if (bkpinfo->backup_media_type == usb) {
    407405        log_msg(1, "Unmounting USB device.");
     406        if (bkpinfo->media_device == NULL) {
     407            fatal_error("USB device set to NULL");
     408        }
    408409        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    409410        run_program_and_log_output(tmp, TRUE);
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

    r2324 r2325  
    448448    /** buffers **********************************************************/
    449449    char *incoming;
    450     char *tmp = NULL;
    451450
    452451    /** pointers *********************************************************/
     
    23302329                                                     char *drive_name)
    23312330{
    2332     /**buffers **********************************************************/
    2333     char *tmp = NULL;
    23342331
    23352332    /** int *************************************************************/
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2324 r2325  
    360360  /**  needs malloc **********/
    361361
    362     char *tarball_fname = NULL;
    363     char *progress_str = NULL;
    364     char *tmp = NULL;
     362    char *tarball_fname, *progress_str;
     363    char *tmp = NULL;
    365364    char *mds = NULL;
    366365    long max_val;
    367366
     367    malloc_string(tarball_fname);
     368    malloc_string(progress_str);
    368369
    369370    assert(bkpinfo != NULL);
    370371    mvaddstr_and_log_it(g_currentY, 0, "Comparing archives");
    371 
    372     malloc_string(tmp);
    373     read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp);
     372    tmp = read_cfg_var(g_mondo_cfg_file, "last-filelist-number");
    374373    max_val = atol(tmp);
     374    mr_free(tmp);
     375
    375376    paranoid_free(tmp);
    376377
     
    442443        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    443444    }
     445    paranoid_free(tarball_fname);
     446    paranoid_free(progress_str);
    444447    return (retval);
    445448}
     
    671674                        0, "Verifying archives against filesystem");
    672675
     676    mr_free(bkpinfo->media_device);
    673677    if (bkpinfo->disaster_recovery && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    674         strcpy(bkpinfo->media_device,
    675                last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    676     } else {
    677         find_cdrom_device(bkpinfo->media_device, FALSE);
     678        mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE"));
     679    } else {
     680        bkpinfo->media_device = find_cdrom_device(FALSE);
    678681    }
    679682    res = verify_tape_backups();
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c

    r2323 r2325  
    22612261/**
    22622262 * Get information about the location of ISO images from the user.
    2263  * @param isodir_device Where to put the device (e.g. /dev/hda4) the user enters.
     2263 * @param isodir_device Where to put the device (e.g. /dev/hda4) the user enters. Allocted by the function
    22642264 * @param isodir_format Where to put the format (e.g. ext2) the user enters.
    22652265 * @param isodir_path Where to put the path (e.g. /var/cache/mondo) the user enters.
     
    22672267 * @return TRUE if OK was pressed, FALSE otherwise.
    22682268 */
    2269 bool get_isodir_info(char *isodir_device, char *isodir_format, char *isodir_path, bool nuke_me_please)
    2270 {
     2269bool get_isodir_info(char *isodir_device, char *isodir_format, char *isodir_path, bool nuke_me_please) {
    22712270
    22722271    char *p = NULL;
     
    22782277    /** initialize ********************************************************/
    22792278
    2280     assert(isodir_device != NULL);
    22812279    assert(isodir_path != NULL);
    22822280
    22832281    log_it("isodir_path = %s", isodir_path);
    2284     if (isodir_device[0] == '\0') {
     2282    if (isodir_device == NULL) {
    22852283        mr_asprintf(idev, "/dev/");
    22862284    } else {
     
    22972295
    22982296    /* modify for the caller */
    2299     strcpy(isodir_device, idev);
     2297    mr_free(isodir_device);
     2298    isodir_device = idev;
    23002299    if (nuke_me_please) {
    23012300        ret = TRUE;
     
    23162315   
    23172316                    /* modify for the caller */
    2318                     strcpy(isodir_device, p);
     2317                    mr_free(isodir_device);
     2318                    isodir_device = p;
    23192319                    mr_free(isodir_path);
    23202320                    isodir_path = r;
     
    23272327        mr_free(p);
    23282328    }
    2329     mr_free(idev);
    23302329    mr_free(isodir_format);
    23312330    return(ret);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2324 r2325  
    9494paranoid_free(g_tmpfs_mountpt);
    9595*/
    96 paranoid_free(g_isodir_device);
     96mr_free(g_isodir_device);
    9797
    9898}
     
    260260    char *command = NULL;
    261261    char *mds = NULL;
    262     char *p = NULL;
    263262    int retval = 0, i;
    264263    bool already_mounted = FALSE;
     
    266265
    267266g_ISO_restore_mode = TRUE;
    268 read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device);
     267mr_free(g_isodir_device);
     268g_isodir_device = read_cfg_var(g_mondo_cfg_file, "iso-dev");
    269269if (bkpinfo->disaster_recovery) {
    270270    /* Patch Conor Daly 26-june-2004
     
    281281}
    282282
     283/* g_isodir_device is passed and modified in this function - memory is managed correctly in it */
    283284if (!get_isodir_info(g_isodir_device, isodir_format, bkpinfo->isodir, nuke_me_please)) {
    284285    mr_free(isodir_format);
     
    570571
    571572    char *mount_cmd = NULL;
    572     char *p = NULL;
    573573    int i, res;
    574574#ifdef __FreeBSD__
     
    585585        log_msg(2, "mount_media() - media already mounted. Fair enough.");
    586586        return (0);
     587    }
     588
     589    if (bkpinfo->media_device == NULL) {
     590        fatal_error("No media device at that point");
    587591    }
    588592
     
    594598            mr_asprintf(bkpinfo->isodir, "/tmp/isodir");
    595599            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
     600        }
     601        if ((bkpinfo->isodir == NULL) || (bkpinfo->nfs_remote_dir == NULL) || (bkpinfo->prefix == NULL)) {
     602            fatal_error("Unable to prepare the iso filename");
    596603        }
    597604#ifdef __FreeBSD__
     
    624631#endif
    625632    } else {
    626         if (bkpinfo->disaster_recovery
    627             && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    628             strcpy(bkpinfo->media_device,
    629                 last_line_of_file("/tmp/CDROM-LIVES-HERE"));
     633        mr_free(bkpinfo->media_device);
     634        if (bkpinfo->disaster_recovery && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
     635            mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    630636        } else {
    631             find_cdrom_device(bkpinfo->media_device, TRUE);
     637            bkpinfo->media_device = find_cdrom_device(TRUE);
    632638        }
    633639
     
    720726t_bkptype media_specified_by_user;
    721727
    722 malloc_string(iso_mnt);
    723 malloc_string(iso_path);
    724 malloc_string(value);
    725728malloc_string(tmp);
    726729//  assert_string_is_neither_NULL_nor_zerolength(cfg_file);
     
    735738media_specified_by_user = bkpinfo->backup_media_type;   // or 'none', if not specified
    736739
    737 if (0 == read_cfg_var(cfg_file, "backup-media-type", value)) {
    738 if (!strcmp(value, "cdstream")) {
    739     bkpinfo->backup_media_type = cdstream;
    740 } else if (!strcmp(value, "cdr")) {
    741     bkpinfo->backup_media_type = cdr;
    742 } else if (!strcmp(value, "cdrw")) {
    743     bkpinfo->backup_media_type = cdrw;
    744 } else if (!strcmp(value, "dvd")) {
    745     bkpinfo->backup_media_type = dvd;
    746 } else if (!strcmp(value, "usb")) {
    747     bkpinfo->backup_media_type = usb;
    748     bkpinfo->please_dont_eject = TRUE;
    749 } else if (!strcmp(value, "iso")) {
    750 
    751 // Patch by Conor Daly - 2004/07/12
    752     bkpinfo->backup_media_type = iso;
    753     if (am_I_in_disaster_recovery_mode()) {
    754         /* Check to see if CD is already mounted before mounting it... */
    755         if (!is_this_device_mounted("/dev/cdrom")) {
    756             log_msg(2,
    757                     "NB: CDROM device not mounted, mounting...");
    758             run_program_and_log_output("mount /dev/cdrom "
    759                                        MNT_CDROM, 1);
    760         }
    761         if (does_file_exist(MNT_CDROM "/archives/filelist.0")) {
    762             bkpinfo->backup_media_type = cdr;
    763             run_program_and_log_output("umount " MNT_CDROM, 1);
    764             log_it
    765                 ("Re-jigging configuration AGAIN. CD-R, not ISO.");
    766         }
    767     }
    768     mr_free(bkpinfo->prefix);
    769     if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    770         mr_asprintf(bkpinfo->prefix, "%s", value);
     740if ((value = read_cfg_var(cfg_file, "backup-media-type")) == 0) {
     741    if (!strcmp(value, "cdstream")) {
     742        bkpinfo->backup_media_type = cdstream;
     743    } else if (!strcmp(value, "cdr")) {
     744        bkpinfo->backup_media_type = cdr;
     745    } else if (!strcmp(value, "cdrw")) {
     746        bkpinfo->backup_media_type = cdrw;
     747    } else if (!strcmp(value, "dvd")) {
     748        bkpinfo->backup_media_type = dvd;
     749    } else if (!strcmp(value, "usb")) {
     750        bkpinfo->backup_media_type = usb;
     751        bkpinfo->please_dont_eject = TRUE;
     752    } else if (!strcmp(value, "iso")) {
     753        // Patch by Conor Daly - 2004/07/12
     754        bkpinfo->backup_media_type = iso;
     755        if (am_I_in_disaster_recovery_mode()) {
     756            /* Check to see if CD is already mounted before mounting it... */
     757            if (!is_this_device_mounted("/dev/cdrom")) {
     758                log_msg(2, "NB: CDROM device not mounted, mounting...");
     759                run_program_and_log_output("mount /dev/cdrom " MNT_CDROM, 1);
     760            }
     761            if (does_file_exist(MNT_CDROM "/archives/filelist.0")) {
     762                bkpinfo->backup_media_type = cdr;
     763                run_program_and_log_output("umount " MNT_CDROM, 1);
     764                log_it
     765                    ("Re-jigging configuration AGAIN. CD-R, not ISO.");
     766            }
     767        }
     768        mr_free(bkpinfo->prefix);
     769        mr_free(value);
     770        if ((value = read_cfg_var(cfg_file, "iso-prefix")) == 0) {
     771            mr_asprintf(bkpinfo->prefix, "%s", value);
     772        } else {
     773            mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
     774        }
     775    } else if (!strcmp(value, "nfs")) {
     776        bkpinfo->backup_media_type = nfs;
     777        bkpinfo->please_dont_eject = TRUE;
     778        mr_free(bkpinfo->prefix);
     779        mr_free(value);
     780        if ((value = read_cfg_var(cfg_file, "iso-prefix")) == 0) {
     781            mr_asprintf(bkpinfo->prefix, "%s", value);
     782        } else {
     783            mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
     784        }
     785   
     786        if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) {
     787            /* We need to override prefix value in PXE mode as it's
     788            * already done in start-nfs */
     789            envtmp1 = getenv("imgname");
     790            if (envtmp1 == NULL) {
     791                fatal_error("no imgname variable in environment");
     792            }
     793            mr_free(bkpinfo->prefix);
     794            mr_asprintf(bkpinfo->prefix, "%s", envtmp1);
     795        }
     796
     797    } else if (!strcmp(value, "tape")) {
     798        bkpinfo->backup_media_type = tape;
     799    } else if (!strcmp(value, "udev")) {
     800        bkpinfo->backup_media_type = udev;
    771801    } else {
    772         mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
    773     }
    774 } else if (!strcmp(value, "nfs")) {
    775     bkpinfo->backup_media_type = nfs;
    776     bkpinfo->please_dont_eject = TRUE;
    777     mr_free(bkpinfo->prefix);
    778     if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    779         mr_asprintf(bkpinfo->prefix, "%s", value);
    780     } else {
    781         mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX);
    782     }
    783 
    784     if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) {
    785         /* We need to override prefix value in PXE mode as it's
    786         * already done in start-nfs */
    787         envtmp1 = getenv("imgname");
    788         if (envtmp1 == NULL) {
    789             fatal_error("no imgname variable in environment");
    790         }
    791         mr_free(bkpinfo->prefix);
    792         mr_asprintf(bkpinfo->prefix, "%s", envtmp1);
    793     }
    794 
    795 } else if (!strcmp(value, "tape")) {
    796     bkpinfo->backup_media_type = tape;
    797 } else if (!strcmp(value, "udev")) {
    798     bkpinfo->backup_media_type = udev;
     802        fatal_error("UNKNOWN bkp-media-type");
     803    }
    799804} else {
    800     fatal_error("UNKNOWN bkp-media-type");
    801 }
    802 } else {
    803 fatal_error("backup-media-type not specified!");
    804 }
     805    fatal_error("backup-media-type not specified!");
     806}
     807mr_free(value);
     808
    805809if (bkpinfo->disaster_recovery) {
    806810    if (bkpinfo->backup_media_type == cdstream) {
    807         sprintf(bkpinfo->media_device, "/dev/cdrom");
    808 //          bkpinfo->media_size[0] = -1;
     811        mr_free(bkpinfo->media_device);
     812        mr_asprintf(bkpinfo->media_device, "/dev/cdrom");
    809813        bkpinfo->media_size[0] = 1999 * 1024;
    810814        bkpinfo->media_size[1] = 650;   /* good guess */
     
    812816        envtmp1 = getenv("MRUSBDEV");
    813817        if (envtmp1 == NULL) {
    814             if (read_cfg_var(cfg_file, "usb-dev", value)) {
     818            if ((value = read_cfg_var(cfg_file, "usb-dev")) == NULL) {
    815819                fatal_error("Cannot get USB device name from cfg file");
    816820            }
    817821        } else {
    818             strcpy(value,envtmp1);
    819         }
    820         sprintf(bkpinfo->media_device, "%s1", value);
     822            mr_asprintf(value,"%s", envtmp1);
     823        }
     824        mr_free(bkpinfo->media_device);
     825        mr_asprintf(bkpinfo->media_device, "%s1", value);
     826        mr_free(value);
    821827        log_msg(2, "Backup medium is USB --- dev=%s", bkpinfo->media_device);
    822     } else if (bkpinfo->backup_media_type == tape
    823             || bkpinfo->backup_media_type == udev) {
    824         if (read_cfg_var(cfg_file, "media-dev", value)) {
     828    } else if (bkpinfo->backup_media_type == tape || bkpinfo->backup_media_type == udev) {
     829        if ((value = read_cfg_var(cfg_file, "media-dev")) == NULL) {
    825830            fatal_error("Cannot get tape device name from cfg file");
    826831        }
    827         strcpy(bkpinfo->media_device, value);
    828         read_cfg_var(cfg_file, "media-size", value);
    829         bkpinfo->media_size[1] = atol(value);
     832        mr_free(bkpinfo->media_device);
     833        bkpinfo->media_device = value;
     834
     835        value = read_cfg_var(cfg_file, "media-size");
     836        if (value != NULL) {
     837            bkpinfo->media_size[1] = atol(value);
     838            mr_free(value);
     839        } else {
     840            bkpinfo->media_size[1] = 0L;
     841        }
    830842        log_msg(2, "Backup medium is TAPE --- dev=%s", bkpinfo->media_device);
    831843    } else {
    832         strcpy(bkpinfo->media_device, "/dev/cdrom");    /* we don't really need this var */
     844        mr_free(bkpinfo->media_device);
     845        mr_asprintf(bkpinfo->media_device, "/dev/cdrom");   /* we don't really need this var */
    833846        bkpinfo->media_size[0] = 1999 * 1024;   /* 650, probably, but we don't need this var anyway */
    834847        bkpinfo->media_size[1] = 1999 * 1024;   /* 650, probably, but we don't need this var anyway */
     
    836849    }
    837850} else {
    838     log_msg(2,
    839         "Not in Disaster Recovery Mode. No need to derive device name from config file.");
    840 }
    841 
    842 read_cfg_var(cfg_file, "use-star", value);
    843 if (strstr(value, "yes")) {
     851    log_msg(2, "Not in Disaster Recovery Mode. No need to derive device name from config file.");
     852}
     853
     854value = read_cfg_var(cfg_file, "use-star");
     855if (value && strstr(value, "yes")) {
    844856    bkpinfo->use_star = TRUE;
    845857    log_msg(1, "Goody! ... bkpinfo->use_star is now true.");
    846858}
    847 
    848 read_cfg_var(cfg_file, "obdr", value);
    849 if (strstr(value, "TRUE")) {
     859mr_free(value);
     860
     861value = read_cfg_var(cfg_file, "obdr");
     862if (value && strstr(value, "TRUE")) {
    850863    bkpinfo->use_obdr = TRUE;
    851864    log_msg(1, "OBDR mode activated");
    852865}
    853 
    854 read_cfg_var(cfg_file, "acl", value);
    855 if (strstr(value, "TRUE")) {
     866mr_free(value);
     867
     868value = read_cfg_var(cfg_file, "acl");
     869if (value && strstr(value, "TRUE")) {
    856870    mr_asprintf(g_getfacl,"setfacl");
    857871    log_msg(1, "We will restore ACLs");
     
    860874    }
    861875}
    862 read_cfg_var(cfg_file, "xattr", value);
    863 if (strstr(value, "TRUE")) {
     876mr_free(value);
     877
     878value = read_cfg_var(cfg_file, "xattr");
     879if (value && strstr(value, "TRUE")) {
    864880    mr_asprintf(g_getfattr,"setfattr");
    865881    log_msg(1, "We will restore XATTRs");
     
    868884    }
    869885}
    870 
    871 if (0 == read_cfg_var(cfg_file, "internal-tape-block-size", value)) {
    872 bkpinfo->internal_tape_block_size = atol(value);
    873 log_msg(1, "Internal tape block size has been custom-set to %ld",
    874         bkpinfo->internal_tape_block_size);
     886mr_free(value);
     887
     888value = read_cfg_var(cfg_file, "internal-tape-block-size");
     889if (value != NULL) {
     890    bkpinfo->internal_tape_block_size = atol(value);
    875891} else {
    876 bkpinfo->internal_tape_block_size =
    877     DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    878 log_msg(1, "Internal tape block size = default (%ld)",
    879         DEFAULT_INTERNAL_TAPE_BLOCK_SIZE);
    880 }
    881 
    882 read_cfg_var(cfg_file, "use-lzo", value);
    883 if (strstr(value, "yes")) {
    884 bkpinfo->use_lzo = TRUE;
    885 bkpinfo->use_gzip = FALSE;
    886 strcpy(bkpinfo->zip_exe, "lzop");
    887 strcpy(bkpinfo->zip_suffix, "lzo");
    888 } else {
    889 read_cfg_var(cfg_file, "use-gzip", value);
    890 if (strstr(value, "yes")) {
     892    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
     893}
     894log_msg(1, "Internal tape block size set to %ld", bkpinfo->internal_tape_block_size);
     895mr_free(value);
     896
     897bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0';
     898value = read_cfg_var(cfg_file, "use-lzo");
     899if (value && strstr(value, "yes")) {
     900    bkpinfo->use_lzo = TRUE;
     901    bkpinfo->use_gzip = FALSE;
     902    strcpy(bkpinfo->zip_exe, "lzop");
     903    strcpy(bkpinfo->zip_suffix, "lzo");
     904}
     905mr_free(value);
     906
     907value = read_cfg_var(cfg_file, "use-gzip");
     908if (value && strstr(value, "yes")) {
    891909    bkpinfo->use_lzo = FALSE;
    892910    bkpinfo->use_gzip = TRUE;
    893911    strcpy(bkpinfo->zip_exe, "gzip");
    894912    strcpy(bkpinfo->zip_suffix, "gz");
     913}
     914mr_free(value);
     915
     916value = read_cfg_var(cfg_file, "use-comp");
     917if (value && strstr(value, "yes")) {
     918    bkpinfo->use_lzo = FALSE;
     919    bkpinfo->use_gzip = FALSE;
     920    strcpy(bkpinfo->zip_exe, "bzip2");
     921    strcpy(bkpinfo->zip_suffix, "bz2");
     922}
     923mr_free(value);
     924
     925value = read_cfg_var(cfg_file, "differential");
     926if (value && (!strcmp(value, "yes") || !strcmp(value, "1"))) {
     927    bkpinfo->differential = TRUE;
     928}
     929log_msg(2, "differential var = '%s'", value);
     930mr_free(value);
     931if (bkpinfo->differential) {
     932    log_msg(2, "THIS IS A DIFFERENTIAL BACKUP");
    895933} else {
    896     read_cfg_var(cfg_file, "use-comp", value);
    897     if (strstr(value, "yes")) {
    898         bkpinfo->use_lzo = FALSE;
    899         bkpinfo->use_gzip = FALSE;
    900         strcpy(bkpinfo->zip_exe, "bzip2");
    901         strcpy(bkpinfo->zip_suffix, "bz2");
    902     } else {
    903         bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0';
    904     }
    905 }
    906 }
    907 
    908 value[0] = '\0';
    909 read_cfg_var(cfg_file, "differential", value);
    910 if (!strcmp(value, "yes") || !strcmp(value, "1")) {
    911 bkpinfo->differential = TRUE;
    912 }
    913 log_msg(2, "differential var = '%s'", value);
    914 if (bkpinfo->differential) {
    915 log_msg(2, "THIS IS A DIFFERENTIAL BACKUP");
    916 } else {
    917 log_msg(2, "This is a regular (full) backup");
    918 }
    919 
    920 read_cfg_var(g_mondo_cfg_file, "please-dont-eject", tmp);
    921 if (tmp[0] || strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "donteject")) {
     934    log_msg(2, "This is a regular (full) backup");
     935}
     936
     937tmp = read_cfg_var(g_mondo_cfg_file, "please-dont-eject");
     938if (tmp || strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "donteject")) {
    922939    bkpinfo->please_dont_eject = TRUE;
    923940    log_msg(2, "Ok, I shan't eject when restoring! Groovy.");
    924941}
     942mr_free(tmp);
    925943
    926944if (bkpinfo->backup_media_type == nfs) {
    927945    if (!cfgf) {
    928         log_msg(2, "nfs_mount remains %s", bkpinfo->nfs_mount);
    929         log_msg(2, "nfs_remote_dir remains %s",
    930                 bkpinfo->nfs_remote_dir);
    931         log_msg(2,
    932                 "...cos it wouldn't make sense to abandon the values that GOT ME to this config file in the first place");
     946        if (bkpinfo->nfs_mount) {
     947            log_msg(2, "nfs_mount remains %s", bkpinfo->nfs_mount);
     948        }
     949        if (bkpinfo->nfs_remote_dir) {
     950            log_msg(2, "nfs_remote_dir remains %s", bkpinfo->nfs_remote_dir);
     951        }
     952        log_msg(2, "...cos it wouldn't make sense to abandon the values that GOT ME to this config file in the first place");
    933953    } else {
    934         read_cfg_var(g_mondo_cfg_file, "nfs-server-mount",
    935                     bkpinfo->nfs_mount);
    936         read_cfg_var(g_mondo_cfg_file, "nfs-server-path",
    937                     bkpinfo->nfs_remote_dir);
    938         log_msg(2, "nfs_mount is %s", bkpinfo->nfs_mount);
    939         log_msg(2, "nfs_remote_dir is %s", bkpinfo->nfs_remote_dir);
    940     }
    941     if (strstr(call_program_and_get_last_line_of_output
    942         ("cat /proc/cmdline"), "pxe")) {
     954        mr_free(bkpinfo->nfs_mount);
     955        bkpinfo->nfs_mount = read_cfg_var(g_mondo_cfg_file, "nfs-server-mount");
     956
     957        mr_free(bkpinfo->nfs_remote_dir);
     958        bkpinfo->nfs_remote_dir = read_cfg_var(g_mondo_cfg_file, "nfs-server-path");
     959
     960        if (bkpinfo->nfs_mount != NULL) {
     961            log_msg(2, "nfs_mount is %s", bkpinfo->nfs_mount);
     962        }
     963        if (bkpinfo->nfs_remote_dir != NULL) {
     964            log_msg(2, "nfs_remote_dir is %s", bkpinfo->nfs_remote_dir);
     965        }
     966    }
     967    if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) {
    943968        /* We need to override values in PXE mode as it's
    944969        * already done in start-nfs */
     
    951976            fatal_error("no dirimg variable in environment");
    952977        }
    953         strcpy(bkpinfo->nfs_mount,envtmp1);
    954         strcpy(bkpinfo->nfs_remote_dir,envtmp2);
     978        mr_free(bkpinfo->nfs_mount);
     979        mr_asprintf(bkpinfo->nfs_mount, "%s", envtmp1);
     980
     981        mr_free(bkpinfo->nfs_remote_dir);
     982        mr_asprintf(bkpinfo->nfs_remote_dir, "%s", envtmp2);
    955983    }
    956984} else if (bkpinfo->backup_media_type == iso) {
     
    960988    */
    961989    mr_asprintf(old_isodir, "%s", bkpinfo->isodir);
    962     read_cfg_var(g_mondo_cfg_file, "iso-mnt", iso_mnt);
    963     read_cfg_var(g_mondo_cfg_file, "isodir", iso_path);
     990    iso_mnt = read_cfg_var(g_mondo_cfg_file, "iso-mnt");
     991    iso_path = read_cfg_var(g_mondo_cfg_file, "isodir");
    964992    mr_free(bkpinfo->isodir);
    965993    mr_asprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);
     994    mr_free(iso_mnt);
     995
    966996    if (!bkpinfo->isodir[0]) {
    967997        mr_free(bkpinfo->isodir);
     
    9791009        }
    9801010    }
    981     read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device);
     1011    mr_free(g_isodir_device);
     1012    g_isodir_device = read_cfg_var(g_mondo_cfg_file, "iso-dev");
    9821013    log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, g_isodir_device);
    9831014
     
    9891020            log_it("command = %s", command);
    9901021            log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    991             sprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
     1022            mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
    9921023            mr_free(command);
    9931024        } else {
    994             sprintf(iso_mnt, "/tmp/isodir");
     1025            mr_asprintf(iso_mnt, "/tmp/isodir");
    9951026            mr_asprintf(tmp1, "mkdir -p %s", iso_mnt);
    9961027            run_program_and_log_output(tmp1, 5);
     
    9991030            mr_asprintf(tmp1, "mount %s %s", g_isodir_device, iso_mnt);
    10001031            if (run_program_and_log_output(tmp1, 3)) {
    1001                 log_msg(1,
    1002                         "Unable to mount isodir. Perhaps this is really a CD backup?");
     1032                log_msg(1, "Unable to mount isodir. Perhaps this is really a CD backup?");
    10031033                bkpinfo->backup_media_type = cdr;
    1004                 strcpy(bkpinfo->media_device, "/dev/cdrom");    /* superfluous */
    1005                 iso_mnt[0] = iso_path[0] = '\0';
     1034                mr_free(bkpinfo->media_device);
     1035                mr_asprintf(bkpinfo->media_device, "/dev/cdrom");   /* superfluous */
    10061036                if (mount_media()) {
    10071037                    mr_free(tmp1);
     
    10191049            bkpinfo->isodir = tmp1;
    10201050        }
    1021     }
     1051        mr_free(iso_mnt);
     1052    }
     1053    mr_free(iso_path);
    10221054}
    10231055
     
    10411073paranoid_free(value);
    10421074paranoid_free(tmp);
    1043 paranoid_free(iso_mnt);
    1044 paranoid_free(iso_path);
    10451075return (0);
    10461076
     
    13161346
    13171347  /** malloc *******/
    1318     char *device;
    1319     char *name;
     1348    char *device = NULL;
     1349    char *name = NULL;
    13201350    char *cmd = NULL;
    1321 
    1322     malloc_string(device);
    1323     malloc_string(name);
    13241351
    13251352    /* In order to have a working bootloader, we need to have all devices
     
    13371364    backup_crucial_file(MNT_RESTORING, "/boot/grub/device.map");
    13381365    backup_crucial_file(MNT_RESTORING, "/etc/mtab");
    1339     read_cfg_var(g_mondo_cfg_file, "bootloader.device", device);
    1340     read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
     1366    device = read_cfg_var(g_mondo_cfg_file, "bootloader.device");
     1367    name = read_cfg_var(g_mondo_cfg_file, "bootloader.name");
    13411368    log_msg(2, "run_boot_loader: device='%s', name='%s'", device, name);
    13421369    system("sync");
     
    13751402    }
    13761403#endif
     1404    mr_free(device);
     1405    mr_free(name);
     1406
    13771407    retval += res;
    13781408    if (res) {
     
    13811411        log_to_screen("Your boot loader ran OK");
    13821412    }
    1383     paranoid_free(device);
    1384     paranoid_free(name);
    13851413    return (retval);
    13861414}
     
    18491877    malloc_string(g_mountlist_fname);
    18501878    malloc_string(g_mondo_home);
    1851     malloc_string(g_isodir_device);
    18521879
    18531880    sprintf(g_biggielist_txt, "%s/%s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB);
     
    21802207            run_program_and_log_output("mkdir -p tmp", FALSE);
    21812208
    2182             if (strlen(bkpinfo->media_device) == 0) {
    2183                 strcpy(bkpinfo->media_device, "/dev/st0");
    2184                 log_msg(2, "media_device is blank; assuming %s");
     2209            if (! bkpinfo->media_device) {
     2210                mr_asprintf(bkpinfo->media_device, "/dev/st0");
     2211                log_msg(2, "media_device is blank; assuming %s", bkpinfo->media_device);
    21852212            }
    21862213            mr_asprintf(tmp, "%s", bkpinfo->media_device);
    21872214            if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    2188                 strcpy(bkpinfo->media_device, "/dev/st0");
     2215                mr_free(bkpinfo->media_device);
     2216                mr_asprintf(bkpinfo->media_device, "/dev/st0");
    21892217                if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    2190                     strcpy(bkpinfo->media_device, "/dev/osst0");
     2218                    mr_free(bkpinfo->media_device);
     2219                    mr_asprintf(bkpinfo->media_device, "/dev/osst0");
    21912220                    if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    2192                         strcpy(bkpinfo->media_device, "/dev/ht0");
     2221                        mr_free(bkpinfo->media_device);
     2222                        mr_asprintf(bkpinfo->media_device, "/dev/ht0");
    21932223                        if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) {
    21942224                            log_msg(3, "I tried lots of devices but none worked.");
    2195                             strcpy(bkpinfo->media_device, tmp);
     2225                            mr_free(bkpinfo->media_device);
     2226                            mr_asprintf(bkpinfo->media_device, "%s", tmp);
    21962227                        }
    21972228                    }
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2324 r2325  
    969969        interactively_obtain_media_parameters_from_user(FALSE);
    970970    }
    971     log_msg(2, "bkpinfo->media_device = %s", bkpinfo->media_device);
    972     if (!bkpinfo->media_device[0]) {
    973         log_msg(2, "Warning - failed to find media dev");
     971    if (!bkpinfo->media_device) {
     972        log_msg(2, "WARNING: failed to find media dev");
     973    } else {
     974        log_msg(2, "bkpinfo->media_device = %s", bkpinfo->media_device);
    974975    }
    975976
     
    19992000    long noof_biggiefiles, bigfileno = 0, total_slices;
    20002001  /** malloc **/
    2001     char *tmp;
    20022002    char *tmp1 = NULL;
    20032003    char *mds = NULL;
     
    20092009    FILE *fbw = NULL;
    20102010
    2011     malloc_string(tmp);
    20122011    malloc_string(pathname_of_last_biggie_restored);
    20132012    assert(bkpinfo != NULL);
     
    20182017    }
    20192018
    2020     read_cfg_var(g_mondo_cfg_file, "total-slices", tmp);
    2021     total_slices = atol(tmp);
     2019    tmp1 = read_cfg_var(g_mondo_cfg_file, "total-slices");
     2020    total_slices = atol(tmp1);
     2021    mr_free(tmp1);
     2022
    20222023    mr_asprintf(tmp1, "Reassembling large files      ");
    20232024    mvaddstr_and_log_it(g_currentY, 0, tmp1);
     
    21082109        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    21092110    }
    2110     paranoid_free(tmp);
    21112111    paranoid_free(pathname_of_last_biggie_restored);
    21122112    return (retval);
     
    21382138    long max_val;
    21392139  /**malloc ***/
    2140     char *tmp = NULL;
    21412140    char *mds = NULL;
    21422141    char *tmp1 = NULL;
     
    21452144    char *comment;
    21462145
    2147     malloc_string(tmp);
    21482146    malloc_string(comment);
    21492147
     
    21572155    }
    21582156    insist_on_this_cd_number(g_current_media_number);
    2159     read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp);
    2160     max_val = atol(tmp) + 1;
    2161     paranoid_free(tmp);
     2157    tmp1 = read_cfg_var(g_mondo_cfg_file, "last-filelist-number");
     2158    max_val = atol(tmp1) + 1;
     2159    mr_free(tmp1);
    21622160
    21632161    mds = media_descriptor_string(bkpinfo->backup_media_type);
     
    22782276
    22792277  /** malloc add ****/
    2280     char *tmp;
    2281     char *tmp1;
     2278    char *tmp1 = NULL;
    22822279    char *biggie_fname;
    22832280    char *biggie_cksum;
     
    22902287    FILE *fbw = NULL;
    22912288
    2292     malloc_string(tmp);
    22932289    malloc_string(biggie_fname);
    22942290    malloc_string(biggie_cksum);
     
    22962292    assert(bkpinfo != NULL);
    22972293
    2298     read_cfg_var(g_mondo_cfg_file, "total-slices", tmp);
    2299 
    2300     total_slices = atol(tmp);
     2294    tmp1 = read_cfg_var(g_mondo_cfg_file, "total-slices");
     2295    total_slices = atol(tmp1);
     2296    mr_free(tmp1);
     2297
    23012298    if (g_getfattr) {
    23022299        mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     
    24082405    paranoid_free(biggie_fname);
    24092406    paranoid_free(biggie_cksum);
    2410     paranoid_free(tmp);
    24112407    return (retval);
    24122408}
     
    24532449    assert(bkpinfo != NULL);
    24542450    mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives");
    2455     read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp);
     2451    tmp = read_cfg_var(g_mondo_cfg_file, "last-filelist-number");
    24562452    max_val = atol(tmp) + 1;
     2453    mr_free(tmp);
    24572454
    24582455    chdir(bkpinfo->restore_path);   /* I don't know why this is needed _here_ but it seems to be. -HR, 02/04/2002 */
     
    25952592            openin_cdstream();
    25962593        } else {
    2597             assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device);
    25982594            openin_tape();
    25992595        }
     
    29332929        // BCO:To be reviewed
    29342930        if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) {
    2935             if (bkpinfo->backup_media_type == nfs
    2936                 && !is_this_device_mounted(bkpinfo->nfs_mount)) {
     2931            if (bkpinfo->backup_media_type == nfs && bkpinfo->nfs_mount && !is_this_device_mounted(bkpinfo->nfs_mount)) {
    29372932                log_msg(1, "Mounting nfs dir");
    29382933                mr_free(bkpinfo->isodir);
  • branches/2.2.10/mondo/src/mondorestore/mr-externs.h

    r2321 r2325  
    6262extern void setup_newt_stuff(void);
    6363extern void init_bkpinfo();
    64 extern int read_cfg_var(char *, char *, char *);
     64extern char *read_cfg_var(char *, char *);
    6565extern int read_file_from_stream_to_file(char *,
    6666                                         long long);
Note: See TracChangeset for help on using the changeset viewer.