Ignore:
Timestamp:
Aug 26, 2007, 12:26:06 PM (13 years ago)
Author:
Bruno Cornec
Message:

Use of conf file entries (iso_burning_*, media_device, media_size)
and adapatation of the rest of the code to that (including bkpinfo)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1581 r1594  
    674674        if (bkpinfo->disaster_recovery
    675675            && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    676             strcpy(bkpinfo->media_device,
     676            mr_allocstr(bkpinfo->media_device,
    677677                   last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    678         } else {
    679             find_cdrom_device(bkpinfo->media_device, TRUE);
    680678        }
    681679
     
    725723                               FALSE);
    726724    if (run_program_and_log_output("ls " MNT_RESTORING " /tmp", FALSE)) {
    727         run_program_and_log_output("chmod 1777 " MNT_RESTORING "/tmp",
    728                                    FALSE);
     725        chmod(MNT_RESTORING "/tmp",1777 );
    729726    }
    730727    run_program_and_log_output("mkdir -p " MNT_RESTORING
    731728                               "/var/run/console", FALSE);
    732     run_program_and_log_output("chmod 777 " MNT_RESTORING "/dev/null",
    733                                FALSE);
     729    chmod(MNT_RESTORING "/dev/null",0777);
    734730    run_program_and_log_output("cd " MNT_RESTORING
    735731                               "; for i in `ls home/`; do echo \"Moving $i's spurious files to $i/.disabled\"; mkdir \"$i\"/.disabled ; mv -f \"$i\"/.DCOP* \"$i\"/.MCOP* \"$i\"/.*authority \"$i\"/.kde/tmp* \"$i\"/.kde/socket* \"$i\"/.disabled/ ; done",
     
    838834    if (bkpinfo->disaster_recovery) {
    839835        if (bkpinfo->backup_media_type == cdstream) {
    840             strcpy(bkpinfo->media_device, "/dev/cdrom");
    841             bkpinfo->media_size = (long)1999*1024;
     836            mr_allocstr(bkpinfo->media_device, "/dev/cdrom");
    842837            bkpinfo->media_size = (long)650;    /* good guess */
    843838        } else if (bkpinfo->backup_media_type == tape
     
    846841                fatal_error("Cannot get tape device name from cfg file");
    847842            }
    848             strcpy(bkpinfo->media_device, value);
     843            mr_allocstr(bkpinfo->media_device, value);
    849844            read_cfg_var(cfg_file, "media-size", value);
    850845            bkpinfo->media_size = atol(value);
     
    852847                    bkpinfo->media_device);
    853848        } else {
    854             strcpy(bkpinfo->media_device, "/dev/cdrom");    /* we don't really need this var */
    855             bkpinfo->media_size = (long)1999*1024;  /* 650, probably, but we don't need this var anyway */
     849            mr_allocstr(bkpinfo->media_device, "/dev/cdrom");   /* we don't really need this var */
    856850            bkpinfo->media_size = (long)1999*1024;  /* 650, probably, but we don't need this var anyway */
    857851            mr_msg(2, "Backup medium is CD-R[W]");
     
    10191013                            "Unable to mount isodir. Perhaps this is really a CD backup?");
    10201014                    bkpinfo->backup_media_type = cdr;
    1021                     strcpy(bkpinfo->media_device, "/dev/cdrom");    /* superfluous */
     1015                    mr_allocstr(bkpinfo->media_device, "/dev/cdrom");   /* superfluous */
    10221016                    bkpinfo->isodir[0] = '\0';
    10231017                    mr_free(iso_mnt);
     
    21502144
    21512145            if (strlen(bkpinfo->media_device) == 0) {
    2152                 strcpy(bkpinfo->media_device, "/dev/st0");
     2146                mr_allocstr(bkpinfo->media_device, "/dev/st0");
    21532147                mr_msg(2, "media_device is blank; assuming %s",
    21542148                        bkpinfo->media_device);
     
    21572151            if (extract_cfg_file_and_mountlist_from_tape_dev
    21582152                (bkpinfo->media_device)) {
    2159                 strcpy(bkpinfo->media_device, "/dev/st0");
     2153                mr_allocstr(bkpinfo->media_device, "/dev/st0");
    21602154                if (extract_cfg_file_and_mountlist_from_tape_dev
    21612155                    (bkpinfo->media_device)) {
    2162                     strcpy(bkpinfo->media_device, "/dev/osst0");
     2156                    mr_allocstr(bkpinfo->media_device, "/dev/osst0");
    21632157                    if (extract_cfg_file_and_mountlist_from_tape_dev
    21642158                        (bkpinfo->media_device)) {
    2165                         strcpy(bkpinfo->media_device, "/dev/ht0");
     2159                        mr_allocstr(bkpinfo->media_device, "/dev/ht0");
    21662160                        if (extract_cfg_file_and_mountlist_from_tape_dev
    21672161                            (bkpinfo->media_device)) {
    21682162                            mr_msg(3,
    21692163                                    "I tried lots of devices but none worked.");
    2170                             strcpy(bkpinfo->media_device, tmp);
     2164                            mr_allocstr(bkpinfo->media_device, tmp);
    21712165                        }
    21722166                    }
Note: See TracChangeset for help on using the changeset viewer.