Changeset 1106 in MondoRescue for trunk/mondo


Ignore:
Timestamp:
Feb 7, 2007, 11:55:11 PM (17 years ago)
Author:
Bruno Cornec
Message:

merge -r1082:1105 $SVN_M/branches/stable

Location:
trunk/mondo/src
Files:
30 edited
3 copied

Legend:

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

    r1086 r1106  
    2020#include "mr_mem.h"
    2121#include "mr_err.h"
     22#include "mr_str.h"
     23#include "mr_file.h"
    2224
    2325#include "libmondo-string-EXT.h"
     
    544546    /*@ buffer ************************************************************ */
    545547    char *tmp = NULL;
    546     char *tmp1 = NULL;
    547     char *tmp2 = NULL;
    548548    char *command = NULL;
    549549    char *use_lzo_sz = NULL;
     
    559559    char *devs_to_exclude = NULL;
    560560    char *use_lilo_sz = NULL;
    561     char *value = NULL;
    562561    char *bootdev = NULL;
    563 
    564562
    565563    /*@ char ************************************************************** */
     
    572570    int res = 0;
    573571    long estimated_total_noof_slices = 0;
     572
     573    FILE *fd = NULL;
     574    FILE *fd1 = NULL;
    574575
    575576    assert(bkpinfo != NULL);
     
    606607        mr_asprintf(&tape_device, " ");
    607608    }
     609    /* BERLIOS: This parameter is not used after? */
     610    mr_free(tape_size_sz);
    608611    if (bkpinfo->use_lzo) {
    609612        mr_asprintf(&use_lzo_sz, "yes");
     
    759762    mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
    760763    if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) {
    761         mr_msg(1, "%ld: Unable to write one-liner boot device", __LINE__);
    762     }
    763     mr_free(tmp);
    764     /* BERLIOS: Use bkptype_to_string without LANG */
    765     switch (bkpinfo->backup_media_type) {
    766     case cdr:
    767         mr_asprintf(&value, "cdr");
    768         break;
    769     case cdrw:
    770         mr_asprintf(&value, "cdrw");
    771         break;
    772     case cdstream:
    773         mr_asprintf(&value, "cdstream");
    774         break;
    775     case tape:
    776         mr_asprintf(&value, "tape");
    777         break;
    778     case udev:
    779         mr_asprintf(&value, "udev");
    780         break;
    781     case iso:
    782         mr_asprintf(&value, "iso");
    783         break;
    784     case nfs:
    785         mr_asprintf(&value, "nfs");
    786         break;
    787     case dvd:
    788         mr_asprintf(&value, "dvd");
    789         break;
    790     case usb:
    791         strcpy(value, "usb");
    792         break;
    793     default:
    794         fatal_error("Unknown backup_media_type");
    795     }
    796     mr_asprintf(&tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
    797     if (write_one_liner_data_file(tmp, value)) {
    798         res++;
    799         mr_msg(1, "%ld: Unable to write one-liner backup-media-type",
    800                 __LINE__);
    801     }
    802     mr_free(value);
    803     mr_free(tmp);
    804     log_to_screen(bkpinfo->tmpdir);
    805     mr_asprintf(&tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
    806     if (write_one_liner_data_file(tmp, bootldr_str)) {
    807         res++;
    808         mr_msg(1, "%ld: Unable to write one-liner bootloader.name",
    809                 __LINE__);
    810     }
    811     mr_free(bootldr_str);
    812     mr_free(tmp);
    813     mr_asprintf(&tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
    814     if (bkpinfo->differential) {
    815         res += write_one_liner_data_file(tmp, "1");
    816     } else {
    817         res += write_one_liner_data_file(tmp, "0");
    818     }
    819     mr_free(tmp);
    820 
    821     if (g_getfattr) {
    822         mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
    823         if (write_one_liner_data_file(tmp1, "TRUE")) {
    824             mr_msg(1, "%ld: Unable to write one-liner XATTR",
    825                 __LINE__);
    826         }
    827         mr_free(tmp1);
    828     }
    829     if (g_getfacl) {
    830         mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
    831         if (write_one_liner_data_file(tmp1, "TRUE")) {
    832             mr_msg(1, "%ld: Unable to write one-liner ACL",
    833                 __LINE__);
    834         }
    835         mr_free(tmp1);
     764        mr_msg(1, "Unable to write one-liner boot device");
     765
    836766    }
    837767
     
    850780        log_OS_error("Unable to make mnt floppy directory");
    851781    }
     782
     783    /* Prepare interface with mindi through a configuration file
     784     * under /var/cache/mondo by default
     785     * and the mondorestore configuration file at the same time that
     786     * will be included by mindi on the initrd */
     787
     788    fd = mr_fopen(MONDO_CACHE"/mindi.conf", "w");
     789    fd1 = mr_fopen(MONDORESTORECFG, "a");
     790
     791    mr_fprintf(fd, "mindi_kernel=%s\n", bkpinfo->kernel_path);
     792    mr_fprintf(fd, "mindi_use_own_kernel=yes\n");
     793
     794    mr_fprintf(fd1, "files-in-filelist %ld\n", lines_in_filelist);
     795    mr_fprintf(fd1, "internal-tape-block-size %ld\n", bkpinfo->internal_tape_block_size);
     796    mr_fprintf(fd1, "total-slices %ld\n", estimated_total_noof_slices);
     797    mr_fprintf(fd1, "excluded-devs %s\n", devs_to_exclude);
     798    mr_free(devs_to_exclude);
     799    mr_fprintf(fd1, "image-devs %s\n", bkpinfo->image_devs);
     800    mr_fprintf(fd1, "last-filelist-number %s\n", last_filelist_number);
     801    mr_free(last_filelist_number);
     802    mr_fprintf(fd1, "bootloader.name %s\n", bootldr_str);
     803    mr_free(bootldr_str);
     804    mr_fprintf(fd1, "bootloader.device %s\n", bkpinfo->boot_device);
     805
     806    switch (bkpinfo->backup_media_type) {
     807    case cdr:
     808        mr_fprintf(fd1, "backup-media-type cdr\n");
     809        break;
     810    case cdrw:
     811        mr_fprintf(fd1, "backup-media-type cdrw\n");
     812        break;
     813    case cdstream:
     814        mr_fprintf(fd1, "backup-media-type cdstream\n");
     815        break;
     816    case tape:
     817        mr_fprintf(fd1, "backup-media-type tape\n");
     818        break;
     819    case udev:
     820        mr_fprintf(fd1, "backup-media-type udev\n");
     821        break;
     822    case iso:
     823        mr_fprintf(fd1, "backup-media-type iso\n");
     824        break;
     825    case nfs:
     826        mr_fprintf(fd1, "backup-media-type nfs\n");
     827        break;
     828    case dvd:
     829        mr_fprintf(fd1, "backup-media-type dvd\n");
     830        break;
     831    case usb:
     832        mr_fprintf(fd1, "backup-media-type usb\n");
     833        break;
     834    default:
     835        fatal_error("Unknown backup_media_type");
     836    }
     837
     838    if (bkpinfo->backup_media_type == usb) {
     839        mr_fprintf(fd, "mindi_write_usb=yes\n");
     840        mr_fprintf(fd, "mindi_usb_device=%s\n", bkpinfo->media_device);
     841    }
     842    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     843        mr_fprintf(fd, "mindi_write_tape=yes\n");
     844        mr_fprintf(fd, "mindi_tape_device=%s\n", bkpinfo->media_device);
     845        mr_fprintf(fd1, "media-dev %s\n", bkpinfo->media_device);
     846        mr_fprintf(fd1, "media-size %ld\n", bkpinfo->media_size[1]);
     847    }
     848    if (bkpinfo->compression_level > 0) {
     849        mr_fprintf(fd1, "use-comp yes\n");
     850    } else {
     851        mr_fprintf(fd1, "use-comp no\n");
     852    }
     853    if (bkpinfo->use_gzip) {
     854        mr_fprintf(fd1, "use-gzip yes\n");
     855    } else {
     856        mr_fprintf(fd1, "use-gzip no\n");
     857    }
     858    if (bkpinfo->use_lzo) {
     859        mr_fprintf(fd1, "use-lzo yes\n");
     860    } else {
     861        mr_fprintf(fd1, "use-lzo no\n");
     862    }
     863    if (bkpinfo->use_star) {
     864        mr_fprintf(fd1, "use-star yes\n");
     865    } else {
     866        mr_fprintf(fd1, "use-star no\n");
     867    }
     868    if (g_getfattr) {
     869        mr_fprintf(fd1, "xattr yes\n");
     870    } else {
     871        mr_fprintf(fd1, "xattr no\n");
     872    }
     873    if (g_getfacl) {
     874        mr_fprintf(fd1, "acl yes\n");
     875    } else {
     876        mr_fprintf(fd1, "acl no\n");
     877    }
     878
     879    if (g_cd_recovery) {
     880        mr_fprintf(fd1, "use-cdrecovery yes\n");
     881    } else {
     882        mr_fprintf(fd1, "use-cdrecovery no\n");
     883    }
     884
     885    if (bkpinfo->make_cd_use_lilo) {
     886        mr_fprintf(fd1, "use-lilo yes\n");
     887    } else {
     888        mr_fprintf(fd1, "use-lilo no\n");
     889    }
     890    if (bkpinfo->nonbootable_backup) {
     891        mr_fprintf(fd1, "non-bootable yes\n");
     892    } else {
     893        mr_fprintf(fd1, "non-bootable no\n");
     894    }
     895    if (bkpinfo->differential) {
     896        mr_fprintf(fd1, "differential 1\n");
     897    } else {
     898        mr_fprintf(fd1, "differential 0\n");
     899    }
     900
     901    mr_fclose(fd);
     902    mr_fprintf(fd1, "datestamp %s\n", mr_date());
     903    mr_fclose(fd1);
     904
     905    mr_asprintf(&command, "mindi --custom '%s' '%s/images'",
     906                bkpinfo->tmpdir, bkpinfo->scratchdir);
     907            //bkpinfo->tmpdir,      // parameter #2
     908            //bkpinfo->scratchdir,  // parameter #3
     909            //bkpinfo->kernel_path, // parameter #4
     910            //tape_device,          // parameter #5
     911            //tape_size_sz,         // parameter #6
     912            //lines_in_filelist,        // parameter #7 (INT)
     913            //use_lzo_sz,               // parameter #8
     914            //cd_recovery_sz,           // parameter #9
     915            //bkpinfo->image_devs,  // parameter #10
     916            //broken_bios_sz,           // parameter #11 always yes
     917            //last_filelist_number, // parameter #12 (STRING)
     918            //estimated_total_noof_slices,  // parameter #13 (INT)
     919            //devs_to_exclude,      // parameter #14
     920            //use_comp_sz,          // parameter #15
     921            //use_lilo_sz,          // parameter #16
     922            //use_star_sz,          // parameter #17
     923            //bkpinfo->internal_tape_block_size,    // parameter #18 (LONG)
     924            //bkpinfo->differential,    // parameter #19 (INT)
     925            //use_gzip_sz);         // parameter #20 (STRING)
     926
     927    mr_msg(2, command);
     928
     929
     930    res = run_program_and_log_to_screen(command, "Generating boot+data disks");
    852931    mr_free(command);
    853 
    854     mr_asprintf(&tmp, "BTW, I'm telling Mindi your kernel is '%s'",
    855              bkpinfo->kernel_path);
    856     log_to_screen(tmp);
    857     mr_free(tmp);
    858 
    859     mr_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
    860 
    861     if (bkpinfo->backup_media_type == usb) {
    862         mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
    863     } else {
    864         mr_asprintf(&tmp2,"");
    865     }
    866 
    867     // Watch it! This next line adds a parameter...
    868     if (bkpinfo->nonbootable_backup) {
    869         mr_asprintf(&tmp, " NONBOOTABLE");
    870     } else {
    871         mr_asprintf(&tmp, " ");
    872     }
    873 
    874     mr_asprintf(&command,
    875             "mindi %s --custom '%s' '%s/images' '%s' '%s' \
    876 '%s' %ld '%s' '%s' '%s' \
    877 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'",
    878             tmp2,
    879             bkpinfo->tmpdir,        // parameter #2
    880             bkpinfo->scratchdir,    // parameter #3
    881             bkpinfo->kernel_path,   // parameter #4
    882             tape_device,            // parameter #5
    883             tape_size_sz,           // parameter #6
    884             lines_in_filelist,      // parameter #7 (INT)
    885             use_lzo_sz,             // parameter #8
    886             cd_recovery_sz,         // parameter #9
    887             bkpinfo->image_devs,    // parameter #10
    888             broken_bios_sz,         // parameter #11
    889             last_filelist_number,   // parameter #12 (STRING)
    890             estimated_total_noof_slices,    // parameter #13 (INT)
    891             devs_to_exclude,        // parameter #14
    892             use_comp_sz,            // parameter #15
    893             use_lilo_sz,            // parameter #16
    894             use_star_sz,            // parameter #17
    895             bkpinfo->internal_tape_block_size,  // parameter #18 (LONG)
    896             bkpinfo->differential,  // parameter #19 (INT)
    897             use_gzip_sz,            // parameter #20 (STRING)
    898             tmp);
    899     mr_free(tmp);
    900     mr_free(tape_size_sz);
    901     mr_free(use_lzo_sz);
    902     mr_free(tape_device);
    903     mr_free(use_star_sz);
    904     mr_free(use_comp_sz);
    905     mr_free(broken_bios_sz);
    906     mr_free(cd_recovery_sz);
    907     mr_free(last_filelist_number);
    908     mr_free(devs_to_exclude);
    909     mr_free(use_lilo_sz);
    910     mr_free(use_gzip_sz);
    911     mr_free(tmp2);
    912 
    913     mr_msg(2, command);
    914 
    915     //  popup_and_OK("Pausing");
    916     res = run_program_and_log_to_screen(command,
    917                                         "Generating boot+data disks");
    918     mr_free(command);
    919 
    920932    if (bkpinfo->nonbootable_backup) {
    921933        res = 0;
     
    11761188        closeout_tape(bkpinfo);
    11771189    } else {
    1178         /* write final ISO */
     1190        /* write final ISO/USB */
    11791191        res = write_final_iso_if_necessary(bkpinfo);
    11801192        retval += res;
     
    18681880        if (bkpinfo->nonbootable_backup) {
    18691881            mr_msg(1, "Making nonbootable backup");
    1870 // FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end
    18711882            res = eval_call_to_make_ISO(bkpinfo,
    18721883                                        "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .",
     
    35633574        bkpinfo->media_size[g_current_media_number]) {
    35643575        mr_asprintf(&tmp,
    3565                  "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
    3566                  (long) space_occupied_by_cd(bkpinfo->scratchdir),
    3567                  (long) bkpinfo->media_size[g_current_media_number]);
     3576                "Warning! %s is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
     3577                media_descriptor_string(bkpinfo->backup_media_type),
     3578                (long) space_occupied_by_cd(bkpinfo->scratchdir),
     3579                (long) bkpinfo->media_size[g_current_media_number]);
    35683580        log_to_screen(tmp);
    35693581        mr_free(tmp);
    35703582    }
    3571     mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    3572              bkpinfo->nfs_remote_dir, bkpinfo->prefix,
    3573              g_current_media_number);
     3583    if (bkpinfo->backup_media_type != usb) {
     3584        mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
     3585            bkpinfo->nfs_remote_dir, bkpinfo->prefix,
     3586            g_current_media_number);
     3587    } else {
     3588    }
    35743589    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    3575         res = make_iso_fs(bkpinfo, isofile);
     3590        if (bkpinfo->backup_media_type != usb) {
     3591            res = make_iso_fs(bkpinfo, isofile);
     3592        } else {
     3593        }
    35763594        if (g_current_media_number == 1 && !res
    35773595            && (bkpinfo->backup_media_type == cdr
     
    38543872
    38553873setenv("MONDO_SHARE", MONDO_SHARE, 1);
     3874setenv("MONDORESTORECFG", MONDORESTORECFG, 1);
     3875setenv("MONDO_CACHE", MONDO_CACHE, 1);
    38563876}
    38573877
  • trunk/mondo/src/common/libmondo-devices.h

    r783 r1106  
    22 * $Id$
    33 */
     4
     5#ifndef LIBMONDO_DEVICES_H
     6# define LIBMONDO_DEVICES_H
    47
    58bool am_I_in_disaster_recovery_mode(void);
     
    3639int eject_device(char *);
    3740
    38 char *list_of_NFS_mounts_only();
     41char *list_of_NFS_mounts_only(void);
    3942
    4043void sensibly_set_tmpdir_and_scratchdir(struct s_bkpinfo *bkpinfo);
     
    5760char *which_partition_format(const char *drive);
    5861char *bkptype_to_string(t_bkptype bt);
     62
     63#endif /* LIBMONDO_DEVICES_H */
  • trunk/mondo/src/common/libmondo-fifo-EXT.h

    r59 r1106  
    44                                    long internal_block_size);
    55extern void sigpipe_occurred(int);
    6 extern void kill_buffer();
     6extern void kill_buffer(void);
  • trunk/mondo/src/common/libmondo-filelist.c

    r1086 r1106  
    395395
    396396
    397 int call_exe_and_pipe_output_to_fd(char *syscall, FILE * pout)
     397int call_exe_and_pipe_output_to_fd(char *sys_call, FILE * pout)
    398398{
    399399    FILE *pattr;
     
    401401    size_t n = 0;
    402402
    403     pattr = popen(syscall, "r");
     403    pattr = popen(sys_call, "r");
    404404    if (!pattr) {
    405         mr_msg(1, "Failed to open fattr() %s", syscall);
     405        mr_msg(1, "Failed to open fattr() %s", sys_call);
    406406        return (1);
    407407    }
    408408    if (feof(pattr)) {
    409         mr_msg(1, "Failed to call fattr() %s", syscall);
     409        mr_msg(1, "Failed to call fattr() %s", sys_call);
    410410        paranoid_pclose(pattr);
    411411        return (2);
     
    426426    FILE *pout;
    427427    char *pout_command;
    428     char *syscall;
     428    char *sys_call;
    429429    char *file_to_analyze = NULL;
    430430    char *strtmp = NULL;
     
    454454        /* BERLIOS : to be checked */
    455455        mr_asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\'));
    456         mr_asprintf(&syscall, "%s 2>> /dev/null", strtmp);
     456        mr_asprintf(&sys_call, "%s 2>> /dev/null", strtmp);
    457457        mr_free(strtmp);
    458         call_exe_and_pipe_output_to_fd(syscall, pout);
    459         mr_free(syscall);
     458        call_exe_and_pipe_output_to_fd(sys_call, pout);
     459        mr_free(sys_call);
    460460    }
    461461    paranoid_fclose(fin);
  • trunk/mondo/src/common/libmondo-files.c

    r1086 r1106  
    1919#include "libmondo-string-EXT.h"
    2020#include "mr_mem.h"
     21
     22#include "mr_file.h"
    2123
    2224/*@unused@*/
     
    10441046    char *command = NULL;
    10451047
     1048    FILE *fd1 = NULL;
     1049
    10461050    /*@ pointers ***** */
    10471051    char *p;
     
    10961100            ("Unable to find ethN (eth0, eth1, ...) adapter via NFS mount you specified.");
    10971101    }
    1098     make_hole_for_dir("/var/cache/mondo-archive");
    10991102    /********
    11001103    * If the NFS device that found above is a bonded device,
     
    11211124    }
    11221125
    1123     mr_asprintf(&tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
    1124     write_one_liner_data_file(tmp, nfs_dev);
    11251126    mr_free(nfs_dev);
    11261127    mr_free(tmp);
    11271128
    1128     mr_asprintf(&tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    1129     write_one_liner_data_file(tmp, nfs_client_ipaddr);
    1130     mr_free(nfs_client_ipaddr);
    1131     mr_free(tmp);
    1132 
    1133     mr_asprintf(&tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    1134     write_one_liner_data_file(tmp, nfs_client_netmask);
    1135     mr_free(nfs_client_netmask);
    1136     mr_free(tmp);
    1137 
    1138     mr_asprintf(&tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    1139     write_one_liner_data_file(tmp, nfs_client_defgw);
    1140     mr_free(nfs_client_defgw);
    1141     mr_free(tmp);
    1142 
    1143     mr_asprintf(&tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    1144     write_one_liner_data_file(tmp, nfs_client_broadcast);
    1145     mr_free(nfs_client_broadcast);
    1146     mr_free(tmp);
    1147 
    1148     mr_asprintf(&tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    1149     write_one_liner_data_file(tmp, nfs_server_ipaddr);
    1150     mr_free(nfs_server_ipaddr);
    1151     mr_free(tmp);
    1152 
    1153     mr_asprintf(&tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
    1154     write_one_liner_data_file(tmp, bkpinfo->nfs_mount);
    1155     mr_free(tmp);
    1156 
    1157     mr_asprintf(&tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    1158     write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir);
    1159     mr_free(tmp);
    1160 
    1161     mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    1162     write_one_liner_data_file(tmp, bkpinfo->prefix);
    1163     mr_free(tmp);
     1129    fd1 = mr_fopen(MONDORESTORECFG, "a");
     1130    mr_fprintf(fd1, "nfs-dev %s\n", nfs_dev);
     1131    mr_fprintf(fd1, "nfs-client-ipaddr %s\n", nfs_client_ipaddr);
     1132    mr_fprintf(fd1, "nfs-client-netmask %s\n", nfs_client_netmask);
     1133    mr_fprintf(fd1, "nfs-client-broadcast %s\n", nfs_client_broadcast);
     1134    mr_fprintf(fd1, "nfs-client-defgw %s\n", nfs_client_defgw);
     1135    mr_fprintf(fd1, "nfs-server-ipaddr %s\n", nfs_server_ipaddr);
     1136    mr_fprintf(fd1, "nfs-server-mount %s\n", bkpinfo->nfs_mount);
     1137    mr_fprintf(fd1, "nfs-server-path %s\n", bkpinfo->nfs_remote_dir);
     1138    mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix);
     1139    mr_fclose(fd1);
    11641140
    11651141    log_it("Finished storing NFS configuration");
  • trunk/mondo/src/common/libmondo-raid.c

    r1086 r1106  
    214214 */
    215215void add_disk_to_raid_device(struct list_of_disks *disklist,
    216                              char *device_to_add, int index)
     216                             char *device_to_add, int idx)
    217217{
    218218    int items;
     
    222222    items = disklist->entries;
    223223    strcpy(disklist->el[items].device, device_to_add);
    224     disklist->el[items].index = index;
     224    disklist->el[items].index = idx;
    225225    items++;
    226226    disklist->entries = items;
     
    652652
    653653    struct list_of_disks *disklist = NULL;
    654     int index = 0;
    655654    int v = 0;
    656655
     
    708707            mr_free(tmp);
    709708        } else {
    710             index = atoi(valueB);
    711             add_disk_to_raid_device(disklist, value, index);
     709            add_disk_to_raid_device(disklist, value, atoi(valueB));
    712710        }
    713711        mr_free(labelB);
  • trunk/mondo/src/common/libmondo-tools-EXT.h

    r171 r1106  
    1 /* libmondo-tools-EXT.h */
     1/* $Id$ */
     2
     3#ifndef LIBMONDO_TOOLS_EXT_H
     4#define LIBMONDO_TOOLS_EXT_H
    25
    36extern void clean_up_KDE_desktop_if_necessary(void);
    4 extern long get_time();
     7extern long get_time(void);
    58extern void (*log_debug_msg) (int debug_level, const char *szFile,
    69                              const char *szFunction, int nLine,
     
    1720extern void initialize_raidrec(struct raid_device_record *raidrec);
    1821#endif
    19 extern int some_basic_system_sanity_checks();
     22extern int some_basic_system_sanity_checks(void);
    2023
    2124
     
    4043extern void free_libmondo_global_strings(void);
    4144
    42 extern double get_kernel_version();
    43 extern char *get_architecture();
     45extern double get_kernel_version(void);
     46extern char *get_architecture(void);
    4447
    4548extern bool does_nonMS_partition_exist(void);
     
    4851extern void stop_magicdev_if_necessary(void);
    4952extern void restart_magicdev_if_necessary(void);
     53
     54#endif /* LIBMONDO_TOOLS_EXT_H */
  • trunk/mondo/src/common/libmondo-tools.c

    r1086 r1106  
    1010#include "my-stuff.h"
    1111#include "mr_mem.h"
     12#include "mr_file.h"
     13
    1214#include "mondostructures.h"
    1315#include "libmondo-tools.h"
     
    362364    int rdsiz_MB;
    363365    char *iso_path = NULL;
     366    FILE *fd1 = NULL;
    364367
    365368    assert(bkpinfo != NULL);
     
    592595                 bkpinfo->isodir);
    593596        log_it("command = %s", command);
    594         tmp = call_program_and_get_last_line_of_output(command);
     597        iso_dev = call_program_and_get_last_line_of_output(command);
    595598        mr_free(command);
    596         log_it("res of it = %s", tmp);
    597         mr_asprintf(&tmp1, "%s/ISO-DEV", bkpinfo->tmpdir);
    598         write_one_liner_data_file(tmp1, tmp);
    599         mr_free(tmp1);
     599        log_it("res of it = %s", iso_dev);
     600
     601        fd1 = mr_fopen(MONDORESTORECFG, "a");
     602        mr_fprintf(fd1, "iso-dev %s\n", iso_dev);
    600603
    601604        mr_asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3",
    602                  tmp);
    603         mr_free(tmp);
     605                 iso_dev);
     606        mr_free(iso_dev);
     607
    604608        log_it("command = %s", command);
    605         tmp = call_program_and_get_last_line_of_output(command);
     609        iso_mnt = call_program_and_get_last_line_of_output(command);
    606610        mr_free(command);
    607         log_it("res of it = %s", tmp);
    608 
    609         mr_asprintf(&tmp1, "%s/ISO-MNT", bkpinfo->tmpdir);
    610         write_one_liner_data_file(tmp1, tmp);
    611         mr_free(tmp1);
    612 
    613         log_it("isomnt: %s, %d", tmp, strlen(tmp));
    614         if (strlen(bkpinfo->isodir) < strlen(tmp)) {
    615             mr_asprintf(&iso_path, " ");
    616         } else {
    617             mr_asprintf(&iso_path, "%s", bkpinfo->isodir + strlen(tmp));
    618         }
    619         mr_free(tmp);
    620 
    621         mr_asprintf(&tmp, "%s/ISODIR", bkpinfo->tmpdir);
    622         write_one_liner_data_file(tmp, iso_path);
    623         mr_free(tmp);
     611
     612        log_it("res of it = %s", iso_mnt);
     613        mr_fprintf(fd1, "iso-mnt %s\n", iso_mnt);
     614        log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt));
     615
     616        mr_asprintf(&iso_tmp, "%s", bkpinfo->isodir);
     617        if (strlen(iso_tmp) >= strlen(iso_mnt)) {
     618            mr_asprintf(&iso_path, "%s", iso_tmp + strlen(iso_mnt));
     619        }
     620        mr_free(iso_tmp);
     621        mr_free(iso_mnt);
     622
    624623        log_it("isodir: %s", iso_path);
     624        mr_fprintf(fd1, "isodir %s\n", iso_path);
    625625        mr_free(iso_path);
    626         mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    627         write_one_liner_data_file(tmp, bkpinfo->prefix);
     626
    628627        log_it("iso-prefix: %s",  bkpinfo->prefix);
    629         mr_free(tmp);
    630 /* End patch */
     628        mr_fprintf(fd1, "iso-prefix %s\n", bkpinfo->prefix);
     629
     630        mr_fclose(fd1);
    631631    }                           // end of iso code
    632632
  • trunk/mondo/src/common/libmondo-tools.h

    r171 r1106  
    33     */
    44
     5#ifndef LIBMONDO_TOOLS_H
     6# define LIBMONDO_TOOLS_H
     7
    58void clean_up_KDE_desktop_if_necessary(void);
    69
    7 long get_time();
     10long get_time(void);
    811extern void (*log_debug_msg) (int debug_level, const char *szFile,
    912                              const char *szFunction, int nLine,
     
    2023void initialize_raidrec(struct raid_device_record *raidrec);
    2124#endif
    22 int some_basic_system_sanity_checks();
     25int some_basic_system_sanity_checks(void);
    2326
    2427
     
    4548void free_libmondo_global_strings(void);
    4649
    47 double get_kernel_version();
    48 char *get_architecture();
     50double get_kernel_version(void);
     51char *get_architecture(void);
    4952bool does_nonMS_partition_exist(void);
    5053void stop_magicdev_if_necessary(void);
    5154void restart_magicdev_if_necessary(void);
     55
     56#endif /* LIBMONDO_TOOLS_H */
  • trunk/mondo/src/common/newt-specific-EXT.h

    r688 r1106  
    55extern bool ask_me_OK_or_cancel(char *prompt);
    66extern void close_evalcall_form(void);
    7 extern void close_progress_form();
     7extern void close_progress_form(void);
    88extern void fatal_error(char *error_string);
    99extern void finish(int signal);
     
    1717extern bool popup_and_get_string(char *title, char *b, char *output);
    1818extern bool popup_with_buttons(char *p, char *button1, char *button2);
    19 extern void refresh_log_screen();
    20 extern void setup_newt_stuff();
     19extern void refresh_log_screen(void);
     20extern void setup_newt_stuff(void);
    2121extern void update_evalcall_form_ratio(int num, int denom);
    2222extern void update_evalcall_form(int curr);
     
    3030
    3131extern t_bkptype which_backup_media_type(bool);
    32 extern int which_compression_level();
     32extern int which_compression_level(void);
    3333
    3434
  • trunk/mondo/src/common/newt-specific.c

    r1086 r1106  
    351351 */
    352352    void
    353      finish(int signal) {
     353     finish(int signal_code) {
    354354        char *command = NULL;
    355355
     356<<<<<<< .courant
     357=======
     358        /*  if (signal_code==0) { popup_and_OK("Please press <enter> to quit."); } */
     359
     360        /* newtPopHelpLine(); */
     361
     362>>>>>>> .fusion-droit.r1105
    356363        register_pid(0, "mondo");
    357364        chdir("/");
     
    378385            }
    379386        }
     387<<<<<<< .courant
    380388        printf(_("Execution run ended; result=%d\n"), signal);
    381389        printf(_("Type 'less %s' to see the output log\n"), MONDO_LOGFILE);
     390=======
     391//  system("clear");
     392//  iamhere("Finished calling newtFinished");
     393        printf("Execution run ended; result=%d\n", signal_code);
     394        printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE);
     395>>>>>>> .fusion-droit.r1105
    382396        free_libmondo_global_strings();
    383         exit(signal);
     397        exit(signal_code);
    384398    }
    385399
     
    650664    void
    651665     popup_and_OK(char *prompt) {
    652         char ch;
     666        int ch;
    653667
    654668        assert_string_is_neither_NULL_nor_zerolength(prompt);
  • trunk/mondo/src/common/newt-specific.h

    r688 r1106  
    33 */
    44
    5 
     5#ifndef NEWT_SPECIFIC_H
     6# define NEWT_SPECIFIC_H
    67#ifndef H_NEWT
    78#include <newt.h>
     
    1112bool ask_me_OK_or_cancel(char *prompt);
    1213void close_evalcall_form(void);
    13 void close_progress_form();
     14void close_progress_form(void);
    1415void fatal_error(char *error_string);
    1516void finish(int signal);
     
    2324bool popup_and_get_string(char *title, char *b, char *output);
    2425bool popup_with_buttons(char *p, char *button1, char *button2);
    25 void refresh_log_screen();
    26 void setup_newt_stuff();
     26void refresh_log_screen(void);
     27void setup_newt_stuff(void);
    2728void update_evalcall_form_ratio(int num, int denom);
    2829void update_evalcall_form(int curr);
     
    3637
    3738t_bkptype which_backup_media_type(bool);
    38 int which_compression_level();
     39int which_compression_level(void);
    3940
    4041
    4142void popup_changelist_from_file(char *source_file);
     43
     44#endif /* NEWT_SPECIFIC_H */
     45
  • trunk/mondo/src/include/mr_err.h

    r1074 r1106  
    99#define MR_ERR_H
    1010
     11#include "mr_msg.h"
     12
    1113/* functions (public methods) */
    1214
    1315extern inline void mr_exit(int errorcode, const char *message);
    14 extern inline void mr_log_exit(int errorcode, const char *message);
     16#define mr_log_exit(x,y) {mr_msg(0,y); mr_exit(x, y);}
    1517
    1618#endif                          /* MR_ERR_H */
  • trunk/mondo/src/include/mr_mem.h

    r1074 r1106  
    1313#endif
    1414#include <stdarg.h>
     15#include <stdio.h>
    1516
    1617/* functions (public methods) */
    1718
    18 extern inline void mr_free(char *allocated);
    19 extern inline void mr_allocstr(char *alloc, const char *orig);
    20 extern inline void mr_asprintf(char **alloc, const char *fmt, ...);
    21 extern inline void mr_getline(char **lineptr, size_t *n, FILE *stream);
    22 extern inline void *mr_malloc(size_t size);
     19#define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__)
     20#define mr_allocstr(x,y) mr_allocstr_int(x, y,__LINE__,__FILE__)
     21#define mr_asprintf(x,y,args...) mr_asprintf_int(x,__LINE__,__FILE__, y, ## args)
     22#define mr_getline(x,y,z) mr_getline_int(x, y,z,__LINE__,__FILE__)
     23#define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__)
     24
     25/* Internal function bringing debuging info
     26 * called indirectly through macros */
     27extern inline void mr_free_int(void **allocated, int line, char *file);
     28extern inline void mr_allocstr_int(char *alloc, const char *orig, int line, char *file);
     29extern inline void mr_asprintf_int(char **alloc, int line, char *file, const char *fmt, ...);
     30extern inline void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, char *file);
     31extern inline void *mr_malloc_int(size_t size, int line, char *file);
    2332
    2433#endif                          /* MR_MEM_H */
  • trunk/mondo/src/include/mr_msg.h

    r1074 r1106  
    1616/* functions (public methods) */
    1717
    18 extern inline void mr_msg(int debug, const char *fmt, ...);
     18#define mr_msg(x,y,args...) {mr_msg_int(x,__LINE__,__FILE__,y,## args);}
    1919extern void mr_msg_init(const char *configfile, int loglevel);
    2020extern void mr_msg_close(void);
    2121
     22/* Internal function bringing debuging info
     23 * called indirectly through macros */
     24extern inline void mr_msg_int(int debug,int line, const char *file, const char *fmt, ...);
     25
    2226#endif                          /* MR_MSG_H */
  • trunk/mondo/src/include/mr_str.h

    r1079 r1106  
    1313extern inline char *mr_strtok(char *instr, const char *delims, int *lastpos);
    1414extern inline char *mr_stresc(char *instr, char *toesc, const char escchr);
     15extern inline char *mr_date(void);
    1516
    1617#endif                          /* MR_STR_H */
  • trunk/mondo/src/include/my-stuff.h

    r1081 r1106  
    1313/*The number of lines of log output to keep at the bottom of the screen.*/
    1414#define NOOF_ERR_LINES  6   
     15
     16/* Hardcoded: Bad for the moment */
     17#define MONDO_CACHE "/var/cache/mondo"
     18#define MONDORESTORECFG MONDO_CACHE"/mondo-restore.cfg"
     19
    1520
    1621/**
     
    270275 * Free variables and call finish(@p x).
    271276 */
    272 #define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) mr_free ( g_bkpinfo_DONTUSETHIS ); finish(x); }
     277#define paranoid_MR_finish(x) {free_MR_global_filenames (); if (g_bkpinfo_DONTUSETHIS) mr_free ( (void*) g_bkpinfo_DONTUSETHIS ); finish(x); }
    273278
    274279/**
  • trunk/mondo/src/lib/Makefile.am

    r900 r1106  
    77noinst_LIBRARIES = libmr.a
    88
    9 libmr_a_SOURCES  = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c
     9libmr_a_SOURCES  = mr_conf.c mr_str.c mr_mem.c mr_err.c mr_msg.c mr_file.c
  • trunk/mondo/src/lib/mr_err.c

    r1074 r1106  
    2727        /* We have to properly end newt */
    2828        /* We have to remind people of log files */
     29        mr_msg_close();
    2930}
    3031
     
    3839    exit(errorcode);
    3940}
    40 
    41 void mr_log_exit(int errorcode, const char *message) {
    42     mr_msg(0, message);
    43     mr_exit(errorcode, message);
    44 }
  • trunk/mondo/src/lib/mr_mem.c

    r1074 r1106  
    2222/*
    2323 * Function that frees memory if necessary
     24 * A pointer to the memory pointed is passed to it.
     25 * *allocated variable points then to the original content
     26 * pointed to by the caller
    2427 */
    25 void mr_free(void *allocated) {
     28void mr_free_int(void **allocated, int line, const char *file) {
    2629
    2730    /* free man pages says that if allocated is NULL
    2831     * nothing happens
    2932     */
    30     free(allocated);
    31     allocated = NULL;
     33    if (*allocated != NULL) {
     34        free(*allocated);
     35        *allocated = NULL;
     36    } else {
     37        mr_msg_int(0,line,file,"Attempt to reference NULL pointer\nExiting...");
     38        mr_exit(-1,"Attempt to reference NULL pointer");
     39    }
    3240}
    3341
    3442/* encapsulation function for malloc */
    35 void *mr_malloc(size_t size) {
     43void *mr_malloc_int(size_t size, int line, const char *file) {
    3644   
    3745    void *ret;
     
    3947    ret = malloc(size);
    4048    if (ret == NULL) {
    41         mr_log_exit(-1,"Unable to alloc memory in mr_malloc\nExiting...");
     49        mr_msg_int(0,line,file,"Unable to alloc memory in mr_malloc\nExiting...");
     50        mr_exit(-1,"Unable to alloc memory in mr_malloc");
    4251    }
    4352    return(ret);
     
    4554
    4655/* encapsulation function for getline */
    47 void mr_getline(char **lineptr, size_t *n, FILE *stream) {
     56void mr_getline_int(char **lineptr, size_t *n, FILE *stream, int line, const char *file) {
    4857   
    4958    ssize_t ret;
     
    5160    ret = getline(lineptr,n,stream);
    5261    if (ret == -1) {
    53         mr_log_exit(-1,"Unable to alloc memory in mr_getline\nExiting...");
     62        mr_msg_int(0,line,file,"Unable to alloc memory in mr_getline\nExiting...",line,file);
     63        mr_exit(-1,"Unable to alloc memory in mr_getline");
    5464    }
    5565}
    5666
    5767/* encapsulation function for asprintf */
    58 void mr_asprintf(char **strp, const char *fmt, ...) {
     68void mr_asprintf_int(char **strp, int line, const char *file, const char *fmt, ...) {
    5969
    6070    int res = 0;
     
    6474    res = vasprintf(strp, fmt, args);
    6575    if (res == -1) {
    66         mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting...");
     76        mr_msg_int(0,line,file,"Unable to alloc memory in mr_asprintf\nExiting...",line,file);
     77        mr_exit(-1,"Unable to alloc memory in mr_asprintf");
    6778    }
    6879    va_end(args);
     
    7384 * freeing it before in any case
    7485 */
    75 void mr_allocstr(char *alloc, const char *orig) {
     86void mr_allocstr_int(char *alloc, const char *orig, int line, const char *file) {
    7687
    77     mr_free((void *)alloc);
    78     mr_asprintf(&alloc, orig);
     88    mr_free_int((void **)&alloc, line, file);
     89    mr_asprintf_int(&alloc, line, file, orig);
    7990}
  • trunk/mondo/src/lib/mr_msg.c

    r1074 r1106  
    5252 * Function that log a message. Not called directly
    5353 * but through other functions
     54 * fmt needs to be just before ...
    5455 */
    55 void mr_msg(int debug, const char *fmt, ...) {
     56void mr_msg_int(int debug, int line, const char *file, const char *fmt, ...) {
    5657
    5758    int i = 0;
     
    7475            for (i = 1; i < debug; i++)
    7576                fprintf(fout, "  ");
    76             fprintf(fout, "%s->%s#%d: ", __FILE__, __FUNCTION__, __LINE__);
     77            fprintf(fout, "%s #%d: ", file, line);
    7778        }
    7879        va_start(args,fmt);
  • trunk/mondo/src/lib/mr_str.c

    r1079 r1106  
    88#include <stdio.h>
    99#include <string.h>
     10#include <time.h>
    1011
    1112#include "mr_mem.h"
     
    105106    return retstr;
    106107}
     108
     109/* Return a string containing the date */
     110char *mr_date(void) {
     111   
     112    time_t tcurr;
     113
     114    tcurr = time(NULL);
     115    return(ctime(&tcurr));
     116}
     117
  • trunk/mondo/src/mondoarchive/main.c

    r1086 r1106  
    1515#include <stdio.h>
    1616#include <stdlib.h>
     17#include <sys/types.h>
     18#include <sys/stat.h>
     19#include <unistd.h>
     20
    1721#include "my-stuff.h"
    1822#include "../common/mondostructures.h"
     
    2125
    2226#include "mr_mem.h"
     27#include "mr_str.h"
     28#include "mr_file.h"
    2329
    2430// for CVS
     
    124130}
    125131
    126 /* Return a string containing the date */
    127 char *mr_date(void) {
    128    
    129     time_t tcurr;
    130 
    131     tcurr = time(NULL);
    132     return(ctime(&tcurr));
    133 }
    134 
    135132/*-----------------------------------------------------------*/
    136133
     
    144141{
    145142    struct s_bkpinfo *bkpinfo;
     143    struct stat stbuf;
    146144    char *tmp;
    147145    int res = 0;
     
    192190    setenv("ARCH", get_architecture(), 1);
    193191
    194     /* Add MONDO_SHARE environment variable for mindi */
     192    /* Add MONDO_SHARE + others environment variable for mindi */
    195193    setenv_mondo_share();
     194
     195    if (stat(MONDO_CACHE, &stbuf) != 0) {
     196        mr_mkdir(MONDO_CACHE,0x755);
     197    }
    196198
    197199    /* Configure the bkpinfo structure, global file paths, etc. */
  • trunk/mondo/src/mondorestore/mondo-prep.c

    r1086 r1106  
    20102010    system("clear");
    20112011    newtResume();
    2012     mr_free(drivelist);
     2012    mr_free((void*) drivelist);
    20132013    return (retval);
    20142014}
     
    26042604    }
    26052605    log_to_screen(_("Mountlist adjusted to suit current hard drive(s)"));
    2606     mr_free(drivelist);
     2606    mr_free((void*) drivelist);
    26072607}
    26082608
  • trunk/mondo/src/mondorestore/mondo-rstr-newt.c

    r1086 r1106  
    6767    /** int ****************************************************************/
    6868    int i = 0;
    69     int index = 0;
     69    int idx = 0;
    7070    int currline = 0;
    7171    int items = 0;
     
    103103            log_it("I don't know what this button does");
    104104        } else {
    105             index = find_next_free_index_in_disklist(disklist);
     105            idx = find_next_free_index_in_disklist(disklist);
    106106
    107107            items = disklist->entries;
    108108            strcpy(disklist->el[items].device,
    109109                   unallocated_raid_partitions->el[currline].device);
    110             disklist->el[items].index = index;
     110            disklist->el[items].index = idx;
    111111            disklist->entries = ++items;
    112112
     
    17331733        calculate_raid_device_size(mountlist, raidlist,
    17341734                                   raidrec->raid_device);
    1735     mr_free(bkp_raidrec);
     1735    mr_free((void*) bkp_raidrec);
    17361736#endif
    17371737}
     
    22592259
    22602260    /** int ***************************************************************/
    2261     int index = -1;
     2261    int idx = -1;
    22622262    int pos = 0;
    22632263
     
    22692269    for (done = FALSE; !done;) {
    22702270        for (pos = 0;
    2271              pos < disklist->entries && disklist->el[pos].index <= index;
     2271             pos < disklist->entries && disklist->el[pos].index <= idx;
    22722272             pos++);
    22732273        if (pos >= disklist->entries) {
    22742274            done = TRUE;
    22752275        } else {
    2276             index = disklist->el[pos].index;
    2277         }
    2278     }
    2279     return (index + 1);
     2276            idx = disklist->el[pos].index;
     2277        }
     2278    }
     2279    return (idx + 1);
    22802280}
    22812281
     
    23352335                char *isodir_path, bool nuke_me_please)
    23362336{
     2337    char *value = NULL;
    23372338
    23382339    /** initialize ********************************************************/
    2339 
    2340     // %d no var ???
    2341     // log_it("%d - AAA - isodir_path = %s", isodir_path);
     2340    malloc_string(value);
     2341
    23422342    if (isodir_device == NULL) {
    23432343        mr_asprintf(&isodir_device, "/dev/");
     
    23462346        mr_asprintf(&isodir_path, "/");
    23472347    }
    2348     if (does_file_exist("/tmp/NFS-SERVER-PATH")) {
    2349         mr_free(isodir_device);
    2350         isodir_device = last_line_of_file("/tmp/NFS-SERVER-MOUNT");
     2348    if (read_cfg_var(g_mondo_cfg_file, "nfs-server-path", value) == 0) {
     2349        read_cfg_var(g_mondo_cfg_file, "nfs-server-mount", isodir_device);
     2350        mr_free(isodir_format);
    23512351        mr_asprintf(&isodir_format, "nfs");
    23522352        mr_free(isodir_path);
    2353         isodir_path = last_line_of_file("/tmp/NFS-SERVER-PATH");
    2354     }
     2353        mr_asprintf(isodir_path, value);
     2354    }
     2355    mr_free(value);
     2356
    23552357    if (nuke_me_please) {
    23562358        return (TRUE);
     
    24512453 * Dummy function that proves that we can get to the point where Mondo is run.
    24522454 */
    2453 void nuke_mode_dummy()
     2455void nuke_mode_dummy(void)
    24542456{
    24552457
     
    29122914               sizeof(struct list_of_disks));
    29132915    }
    2914     mr_free(bkp_raidrec);
    2915     mr_free(bkp_disklist);
    2916     mr_free(bkp_raidlist);
    2917     mr_free(unallocated_raid_partitions);
     2916    mr_free((void*) bkp_raidrec);
     2917    mr_free((void*) bkp_disklist);
     2918    mr_free((void*) bkp_raidlist);
     2919    mr_free((void*) unallocated_raid_partitions);
    29182920}
    29192921#endif
  • trunk/mondo/src/mondorestore/mondo-rstr-newt.h

    r783 r1106  
    120120char *mountlist_entry_to_string(struct mountlist_itself *, int);
    121121void mvaddstr_and_log_it(int, int, char *);
    122 void nuke_mode_dummy();
     122void nuke_mode_dummy(void);
    123123char *number_of_disks_as_string(int, char *);
    124124void open_evalcall_form(char *);
  • trunk/mondo/src/mondorestore/mondo-rstr-tools-EXT.h

    r914 r1106  
    33**/
    44
    5 extern void free_MR_global_filenames();
     5extern void free_MR_global_filenames(void);
    66extern void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *);
    77extern bool is_file_in_list(char *, char *, char *);    /* needle, haystack, preamble */
  • trunk/mondo/src/mondorestore/mondo-rstr-tools.c

    r1086 r1106  
    5555 * Free the malloc()s for the filename variables.
    5656 */
    57 void free_MR_global_filenames()
     57void free_MR_global_filenames(void)
    5858{
    5959    mr_free(g_biggielist_txt);
     
    537537
    538538    assert(p_external_copy_of_mountlist != NULL);
    539     mountlist = mr_malloc(sizeof(struct mountlist_itself));
     539    mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));
    540540    memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    541541           sizeof(struct mountlist_itself));
     
    620620    }
    621621    run_program_and_log_output("df -m", 3);
    622     mr_free(mountlist);
     622    mr_free((void*) mountlist);
    623623    return (retval);
    624624}
     
    918918
    919919    read_cfg_var(cfg_file, "acl", value);
    920     if (strstr(value, "TRUE")) {
     920    if (strstr(value, "yes")) {
    921921        mr_asprintf(&g_getfacl,"setfacl");
    922922        mr_msg(1, "We will restore ACLs");
     
    926926    }
    927927    read_cfg_var(cfg_file, "xattr", value);
    928     if (strstr(value, "TRUE")) {
     928    if (strstr(value, "yes")) {
    929929        mr_asprintf(&g_getfattr,"setfattr");
    930930        mr_msg(1, "We will restore XATTRs");
     
    20272027    assert(p_external_copy_of_mountlist != NULL);
    20282028
    2029     mountlist = mr_malloc(sizeof(struct mountlist_itself));
     2029    mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));
    20302030    memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist,
    20312031           sizeof(struct mountlist_itself));
     
    21202120        log_to_screen(_("All partitions were unmounted OK."));
    21212121    }
    2122     mr_free(mountlist);
     2122    mr_free((void*) mountlist);
    21232123    return (retval);
    21242124}
     
    24412441    char *screen_message = NULL;
    24422442
    2443     raidlist = mr_malloc(sizeof(struct raidlist_itself));
     2443    raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself));
    24442444
    24452445    assert(wait_for_percentage <= 100);
     
    24792479        }
    24802480    }
    2481     mr_free(raidlist);
    2482 }
     2481    mr_free((void*) raidlist);
     2482}
  • trunk/mondo/src/mondorestore/mondo-rstr-tools.h

    r1079 r1106  
    33**/
    44
    5 void free_global_filenames();
     5void free_global_filenames(void);
    66void get_cfg_file_from_archive_or_bust(struct s_bkpinfo *);
    77bool is_file_in_list(char *, char *, char *);   /* needle, haystack, preamble */
  • trunk/mondo/src/test/mktest

    r1079 r1106  
    77
    88lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c"
    9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align -O2 -g -I../common -I../include"
     9OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Winit-self -Wcast-align -fno-strict-aliasing -O2 -g -I../common -I../include"
    1010
    1111echo "Generating test-msg"
     
    1515echo "Generating test-conf"
    1616gcc $OPT test-conf.c $lib -o test-conf
     17echo "Generating test-mem"
     18gcc $OPT test-mem.c $lib -o test-mem
    1719
    1820echo "Testing against previous run"
    19 for f in test-conf test-string test-msg; do
     21for f in test-conf test-string test-msg test-mem; do
    2022    chmod 755 $f
    2123    ./$f > /tmp/$f.res
     
    2325    if [ $? -ne 0 ]; then
    2426        echo "$f test KO !!"
     27    else
     28        echo "$f test OK"
    2529    fi
    2630    valgrind -q --error-exitcode=1 --leak-check=yes ./$f 2>&1 > /tmp/valgrind-$f.res
Note: See TracChangeset for help on using the changeset viewer.