Changeset 3205


Ignore:
Timestamp:
Dec 6, 2013, 3:40:47 PM (5 years ago)
Author:
bruno
Message:
  • Fix mondoarchive which now works in text mode. GUI mode still not working and crashing on first update for backup. Needs more

investigation in newt-specific.c

Location:
branches/3.2/mondo/src
Files:
10 edited

Legend:

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

    r3197 r3205  
    526526
    527527    /*@ long     ********************************************************** */
    528     long lines_in_filelist = 0;
     528    long lines_in_filelist = 0L;
    529529
    530530    /*@ int     ************************************************************* */
    531531    int res = 0;
    532     long estimated_total_noof_slices = 0;
     532    long estimated_total_noof_slices = 0L;
    533533
    534534    assert(bkpinfo != NULL);
     
    608608
    609609    update_evalcall_form(2);
    610     if (!bkpinfo->nonbootable_backup
    611         && (bkpinfo->boot_loader == '\0'
    612             || bkpinfo->boot_device[0] == '\0')) {
     610    if (!bkpinfo->nonbootable_backup && (bkpinfo->boot_loader == '\0' || bkpinfo->boot_device[0] == '\0')) {
    613611
    614612#ifdef __FreeBSD__
    615         mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    616                ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     613        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    617614        if (!bootdev[0]) {
    618615            mr_free(bootdev);
    619             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    620                    ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     616            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    621617        }
    622618#else
    623619        /* Linux */
    624620#ifdef __IA64__
    625         mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    626                ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     621        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    627622#else
    628         mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    629                ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     623        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    630624#endif
    631625        if (strstr(bootdev, "/dev/cciss/")) {
    632626            mr_free(bootdev);
    633627#ifdef __IA64__
    634             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    635                    ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     628            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    636629#else
    637             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    638                    ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     630            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    639631#endif
    640632        }
    641633        if (!bootdev[0]) {
    642634            mr_free(bootdev);
    643             mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    644                    ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     635            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    645636            if (strstr(bootdev, "/dev/cciss/")) {
    646637                mr_free(bootdev);
    647                 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    648                        ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     638                mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    649639            }
    650640        }
     
    675665           bkpinfo->boot_loader != 'E' &&
    676666#endif
    677            bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G'
    678            && bkpinfo->boot_loader != 'R'
    679            && !bkpinfo->nonbootable_backup) {
    680         fatal_error
    681             ("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual.");
     667           bkpinfo->boot_loader != 'L' && bkpinfo->boot_loader != 'G' && bkpinfo->boot_loader != 'R' && !bkpinfo->nonbootable_backup) {
     668        fatal_error("Please specify your boot loader and device, e.g. -l GRUB -f /dev/hda. Type 'man mondoarchive' to read the manual.");
    682669    }
    683670    if (bkpinfo->boot_loader == 'L') {
    684671        mr_asprintf(bootldr_str, "LILO");
    685672        if (!does_file_exist("/etc/lilo.conf")) {
     673            mr_free(bootldr_str);
    686674            fatal_error("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?");
    687675        }
     
    692680        }
    693681        if ((!does_file_exist("/boot/grub/menu.lst")) && (!does_file_exist("/boot/grub/grub.cfg")) && (!does_file_exist("/boot/grub2/grub.cfg"))) {
     682            mr_free(bootldr_str);
    694683            fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?");
    695684        }
     
    697686    } else if (bkpinfo->boot_loader == 'E') {
    698687        mr_asprintf(bootldr_str, "ELILO");
    699         /* BCO: fix it for Debian, Mandrake, ... */
     688        /* BCO: fix it for Debian, Mageia, ... */
    700689        if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) {
    701690            run_program_and_log_output("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 5);
     
    711700        }
    712701        if (!does_file_exist("/etc/elilo.conf")) {
     702            mr_free(bootldr_str);
    713703            fatal_error("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'");
    714704        }
     
    783773        log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__);
    784774    }
    785     mr_free(value);
    786775    mr_free(tmp);
    787776
     
    791780        log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__);
    792781    }
    793     mr_free(bootldr_str);
     782    r_free(bootldr_str);
    794783    mr_free(tmp);
    795784
     
    814803        mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir);
    815804        if (write_one_liner_data_file(tmp1, "TRUE")) {
    816             log_msg(1, "%ld: Unable to write one-liner XATTR",
    817                 __LINE__);
    818         }
    819         paranoid_free(tmp1);
     805            log_msg(1, "%ld: Unable to write one-liner XATTR", __LINE__);
     806        }
     807        mr_free(tmp1);
    820808    }
    821809    if (g_getfacl) {
    822810        mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir);
    823811        if (write_one_liner_data_file(tmp1, "TRUE")) {
    824             log_msg(1, "%ld: Unable to write one-liner ACL",
    825                 __LINE__);
    826         }
    827         paranoid_free(tmp1);
     812            log_msg(1, "%ld: Unable to write one-liner ACL", __LINE__);
     813        }
     814        mr_free(tmp1);
    828815    }
    829816    if (bkpinfo->use_obdr) {
    830817        mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir);
    831818        if (write_one_liner_data_file(tmp1, "TRUE")) {
    832             log_msg(1, "%ld: Unable to write one-liner OBDR",
    833                 __LINE__);
    834         }
    835         paranoid_free(tmp1);
     819            log_msg(1, "%ld: Unable to write one-liner OBDR", __LINE__);
     820        }
     821        mr_free(tmp1);
    836822    }
    837823
     
    876862            MONDO_LOGFILE);
    877863
     864    mr_free(tmp2);
     865    mr_free(tape_device);
     866    mr_free(tape_size_sz);
     867    mr_free(use_lzo_sz);
     868    mr_free(cd_recovery_sz);
     869    mr_free(broken_bios_sz);
    878870    mr_free(last_filelist_number);
    879     mr_free(tape_device);
    880     mr_free(use_lzo_sz);
     871    mr_free(use_comp_sz);
     872    mr_free(use_lilo_sz);
     873    mr_free(use_star_sz);
    881874    mr_free(use_gzip_sz);
    882875    mr_free(use_lzma_sz);
    883     mr_free(use_star_sz);
    884     mr_free(use_comp_sz);
    885     mr_free(broken_bios_sz);
    886     mr_free(cd_recovery_sz);
    887     mr_free(use_lilo_sz);
    888     mr_free(tape_size_sz);
     876    mr_free(value);
    889877
    890878    /* This parameter is always the last one and optional */
     
    11831171 * @ingroup MLarchiveGroup
    11841172 */
    1185 int do_that_initial_phase()
    1186 {
     1173int do_that_initial_phase() {
    11871174    /*@ int *************************************** */
    11881175    int retval = 0;
     
    12291216    mr_free(data_disks_file);
    12301217
    1231     mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix);
     1218    if (bkpinfo->netfs_remote_dir != NULL) {
     1219        mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix);
     1220    } else {
     1221        mr_asprintf(command, "rm -f %s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->prefix);
     1222    }
    12321223    paranoid_system(command);
    12331224    mr_free(command);
     
    12361227    mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    12371228    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    1238         write_header_block_to_stream((off_t)0, "start-of-tape",
    1239                                      BLK_START_OF_TAPE);
    1240         write_header_block_to_stream((off_t)0, "start-of-backup",
    1241                                      BLK_START_OF_BACKUP);
     1229        write_header_block_to_stream((off_t)0, "start-of-tape", BLK_START_OF_TAPE);
     1230        write_header_block_to_stream((off_t)0, "start-of-backup", BLK_START_OF_BACKUP);
    12421231    }
    12431232    return (retval);
     
    13551344    srand((unsigned int) getpid());
    13561345    g_sem_key = 1234 + random() % 30000;
    1357     if ((g_sem_id =
    1358          semget((key_t) g_sem_key, 1,
    1359                 IPC_CREAT | S_IREAD | S_IWRITE)) == -1) {
     1346    if ((g_sem_id = semget((key_t) g_sem_key, 1, IPC_CREAT | S_IREAD | S_IWRITE)) == -1) {
    13601347        fatal_error("MABAI - unable to semget");
    13611348    }
     
    13661353        log_msg(8, "Creating thread #%d", noof_threads);
    13671354        (*p_archival_threads_running)++;
    1368         if ((res =
    1369              pthread_create(&archival_thread[noof_threads], NULL,
    1370                             create_afio_files_in_background,
    1371                             (void *) transfer_block))) {
     1355        if ((res = pthread_create(&archival_thread[noof_threads], NULL, create_afio_files_in_background, (void *) transfer_block))) {
    13721356            fatal_error("Unable to create an archival thread");
    13731357        }
     
    13811365        if (*p_archival_threads_running == 0
    13821366            && *p_last_set_archived == storing_set_no - 1) {
    1383             log_msg(2,
    1384                     "No archival threads are running. The last stored set was %d and I'm looking for %d. Take off your make-up; the party's over... :-)",
    1385                     *p_last_set_archived, storing_set_no);
     1367            log_msg(2, "No archival threads are running. The last stored set was %d and I'm looking for %d. Take off your make-up; the party's over... :-)", *p_last_set_archived, storing_set_no);
    13861368            done_storing = TRUE;
    13871369        } else
    1388             if (!get_bit_N_of_array
    1389                 (p_list_of_fileset_flags, storing_set_no)) {
    1390             misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5;
    1391             /* BCO the media_usage_comment is not really initialized there !
    1392             if (!misc_counter_that_is_not_important) {
    1393                 update_progress_form(media_usage_comment);
    1394             }
    1395             */
    1396             sleep(1);
     1370            if (!get_bit_N_of_array(p_list_of_fileset_flags, storing_set_no)) {
     1371                misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5;
     1372                sleep(1);
    13971373            } else {
    13981374                // store set N
     
    14071383
    14081384                log_msg(2, "Storing set %d", storing_set_no);
    1409                 while (!does_file_exist(storing_filelist_fname)
    1410                     || !does_file_exist(storing_afioball_fname)) {
    1411                     log_msg(2,
    1412                             "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.",
    1413                         storing_filelist_fname, storing_afioball_fname);
     1385                while (!does_file_exist(storing_filelist_fname) || !does_file_exist(storing_afioball_fname)) {
     1386                    log_msg(2, "Warning - either %s or %s doesn't exist yet. I'll pause 5 secs.", storing_filelist_fname, storing_afioball_fname);
    14141387                    sleep(5);
    14151388                }
    14161389                /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    14171390                if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    1418                     register_in_tape_catalog(fileset, storing_set_no, -1,
    1419                                          storing_afioball_fname);
     1391                    register_in_tape_catalog(fileset, storing_set_no, -1, storing_afioball_fname);
    14201392                    maintain_collection_of_recent_archives(bkpinfo->tmpdir, storing_afioball_fname);
    14211393                    log_it("Writing EXAT files");
    1422                     res +=
    1423                         write_EXAT_files_to_tape(curr_xattr_list_fname,
    1424                                              curr_acl_list_fname);
     1394                    res += write_EXAT_files_to_tape(curr_xattr_list_fname, curr_acl_list_fname);
    14251395                    // archives themselves
    1426                     res +=
    1427                         move_files_to_stream(storing_afioball_fname,
    1428                                          NULL);
     1396                    res += move_files_to_stream(storing_afioball_fname, NULL);
    14291397                } else {
    14301398                    if (g_getfacl) {
    14311399                        if (g_getfattr) {
    1432                             res = move_files_to_cd(storing_filelist_fname,
    1433                                      curr_xattr_list_fname,
    1434                                      curr_acl_list_fname,
    1435                                      storing_afioball_fname, NULL);
     1400                            res = move_files_to_cd(storing_filelist_fname, curr_xattr_list_fname, curr_acl_list_fname, storing_afioball_fname, NULL);
    14361401                        } else {
    1437                             res = move_files_to_cd(storing_filelist_fname,
    1438                                     curr_acl_list_fname,
    1439                                     storing_afioball_fname, NULL);
     1402                            res = move_files_to_cd(storing_filelist_fname, curr_acl_list_fname, storing_afioball_fname, NULL);
    14401403                        }
    14411404                    } else {
    14421405                        if (g_getfattr) {
    1443                             res = move_files_to_cd(storing_filelist_fname,
    1444                                     curr_xattr_list_fname,
    1445                                     storing_afioball_fname, NULL);
     1406                            res = move_files_to_cd(storing_filelist_fname, curr_xattr_list_fname, storing_afioball_fname, NULL);
    14461407                        } else {
    1447                             res = move_files_to_cd(storing_filelist_fname,
    1448                                     storing_afioball_fname, NULL);
     1408                            res = move_files_to_cd(storing_filelist_fname, storing_afioball_fname, NULL);
    14491409                        }
    14501410                    }
     
    19671927    char *ntfsprog_fifo = NULL;
    19681928    /*@ long *********************************************** */
    1969     long biggie_file_number = 0;
    1970     long noof_biggie_files = 0;
    1971     long estimated_total_noof_slices = 0;
     1929    long biggie_file_number = 0L;
     1930    long noof_biggie_files = 0L;
     1931    long estimated_total_noof_slices = 0L;
    19721932
    19731933    /*@ int ************************************************ */
     
    19831943    assert_string_is_neither_NULL_nor_zerolength(biggielist_fname);
    19841944
    1985     estimated_total_noof_slices =
    1986         size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1;
    1987 
    1988     log_msg(1, "size of all biggiefiles = %ld",
    1989             size_of_all_biggiefiles_K());
    1990     log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld",
    1991             size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size,
    1992             estimated_total_noof_slices);
     1945    estimated_total_noof_slices = size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1L;
     1946
     1947    log_msg(1, "size of all biggiefiles = %ld", size_of_all_biggiefiles_K());
     1948    log_msg(1, "estimated_total_noof_slices = %ld KB / %ld KB = %ld", size_of_all_biggiefiles_K(), bkpinfo->optimal_set_size, estimated_total_noof_slices);
    19931949
    19941950    if (length_of_file(biggielist_fname) < 6) {
     
    21022058
    21032059    log_msg(1, "Finished backing up bigfiles");
    2104     log_msg(1, "estimated slices = %ld; actual slices = %ld",
    2105             estimated_total_noof_slices, g_current_progress);
     2060    log_msg(1, "estimated slices = %ld; actual slices = %ld", estimated_total_noof_slices, g_current_progress);
    21062061    close_progress_form();
    21072062    paranoid_fclose(fin);
     
    22542209    assert(bkpinfo != NULL);
    22552210
    2256     mvaddstr_and_log_it(g_currentY, 0,
    2257                         "Archiving regular files to media          ");
     2211    mvaddstr_and_log_it(g_currentY, 0, "Archiving regular files to media          ");
    22582212
    22592213    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2260         write_header_block_to_stream((off_t)0, "start-of-afioballs",
    2261                                      BLK_START_AFIOBALLS);
     2214        write_header_block_to_stream((off_t)0, "start-of-afioballs", BLK_START_AFIOBALLS);
    22622215#if __FreeBSD__ == 5
    2263         log_msg(1,
    2264                 "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0");
     2216        log_msg(1, "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0");
    22652217        res = make_afioballs_and_images_OLD();
    22662218#else
  • branches/3.2/mondo/src/common/libmondo-cli.c

    r3194 r3205  
    236236        if (!strcmp(bkpinfo->include_paths, "/")) {
    237237            log_msg(2, "'/' is pleonastic.");
    238             bkpinfo->include_paths[0] = '\0';
     238            mr_free(bkpinfo->include_paths);
    239239        }
    240240        if (bkpinfo->include_paths[0]) {
    241             strcat(bkpinfo->include_paths, "|");
     241            mr_strcat(bkpinfo->include_paths, "|");
    242242        }
    243243
     
    454454            *p = '\0';
    455455        }
    456         mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*[%s@]*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_user, bkpinfo->netfs_mount);
     456        if (bkpinfo->netfs_user != NULL) {
     457            mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*[%s@]*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_user, bkpinfo->netfs_mount);
     458        } else {
     459            mr_asprintf(tmp1, "mount | grep -E \"^[a-z]*#*%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount);
     460        }
    457461        strncpy(bkpinfo->isodir, call_program_and_get_last_line_of_output(tmp), MAX_STR_LEN / 4);
    458462        mr_free(tmp1);
     
    679683            sprintf(tmp, "ls -l %s", bkpinfo->isodir);
    680684            if (run_program_and_log_output(tmp, 2)) {
    681                 fatal_error
    682                     ("output folder does not exist - please create it");
     685                fatal_error("output folder does not exist - please create it");
    683686            }
    684687        } else if (flag_set['n']) {
  • branches/3.2/mondo/src/common/libmondo-devices.c

    r3196 r3205  
    25612561        }
    25622562        if (bkpinfo->netfs_remote_dir == NULL) {
    2563             fatal_error("bkpinfo->netfs_remote_dir shold not be NULL");
     2563            fatal_error("bkpinfo->netfs_remote_dir should not be NULL");
    25642564        }
    25652565        strcpy(tmp1, bkpinfo->netfs_remote_dir);
     
    25842584        }
    25852585        log_msg(3, "prefix set to %s", bkpinfo->prefix);
    2586 
    25872586        log_msg(3, "Just set netfs_remote_dir to %s", bkpinfo->netfs_remote_dir);
    25882587        log_msg(3, "isodir is still %s", bkpinfo->isodir);
     
    26882687        bkpinfo->boot_loader = i;
    26892688
    2690         mr_free(bkpinfo->include_paths);
    2691         strcpy(tmp1, "/");
     2689        if (bkpinfo->include_paths) {
     2690            strcpy(tmp1, bkpinfo->include_paths);
     2691            mr_free(bkpinfo->include_paths);
     2692        } else {
     2693            strcpy(tmp1, "/");
     2694        }
    26922695        if (!popup_and_get_string
    26932696            ("Backup paths",
     
    28312834    log_it("compression = %ld", bkpinfo->compression_level);
    28322835    log_it("exclude_path = %s", bkpinfo->exclude_paths);
    2833     log_it("include_path = %s", bkpinfo->include_paths);
     2836    if (bkpinfo->include_paths) {
     2837        log_it("include_path = %s", bkpinfo->include_paths);
     2838    }
    28342839
    28352840    /* Handle devices passed in bkpinfo and print result */
     
    30103015 * The mountpoint (where it's mounted) will obviously be '/'.
    30113016 */
    3012 char *where_is_root_mounted()
    3013 {
    3014     /*@ buffers **************** */
    3015     static char tmp[MAX_STR_LEN];
     3017char *where_is_root_mounted() {
     3018
     3019/*@ buffers **************** */
     3020static char tmp[MAX_STR_LEN];
    30163021
    30173022
    30183023#ifdef __FreeBSD__
    3019     strcpy(tmp, call_program_and_get_last_line_of_output
    3020            ("mount | grep \" on / \" | cut -d' ' -f1"));
     3024    strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1"));
    30213025#else
    3022     strcpy(tmp, call_program_and_get_last_line_of_output
    3023            ("mount | grep \" on / \" | cut -d' ' -f1 | sed s/[0-9]// | sed s/[0-9]//"));
     3026    strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1 | sed s/[0-9]// | sed s/[0-9]//"));
    30243027    if (strstr(tmp, "/dev/cciss/")) {
    3025         strcpy(tmp, call_program_and_get_last_line_of_output
    3026                ("mount | grep \" on / \" | cut -d' ' -f1 | cut -dp -f1"));
     3028        strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1 | cut -dp -f1"));
    30273029    }
    30283030    if (strstr(tmp, "/dev/md")) {
    3029         strcpy(tmp,
    3030                call_program_and_get_last_line_of_output
    3031                ("mount | grep \" on / \" | cut -d' ' -f1"));
    3032     }
    3033 #endif
    3034 
    3035     return (tmp);
     3031        strcpy(tmp, call_program_and_get_last_line_of_output("mount | grep \" on / \" | cut -d' ' -f1"));
     3032    }
     3033#endif
     3034
     3035return (tmp);
    30363036}
    30373037
  • branches/3.2/mondo/src/common/libmondo-filelist.c

    r3194 r3205  
    13021302    struct dirent *dit;
    13031303    struct stat statbuf;
    1304     char *new;
     1304    char *new = NULL;
    13051305    char *tmp = NULL;
    13061306    char *dir = NULL;
    13071307    static int percentage = 0;
    13081308    char *skip_these = NULL;
    1309     char *new_with_pipe;
     1309    char *new_with_pipe = NULL;
    13101310    char *strtmp = NULL;
    13111311    char *token = NULL;
     
    13951395        mr_free(find_skeleton_marker);
    13961396    }
     1397    mr_free(dir);
    13971398
    13981399    depth++;
    13991400
    1400 //  log_msg(0, "Cataloguing %s", dir);
    14011401    mr_asprintf(skip_these, "|%s|", sth);
    14021402   
     
    14551455    mr_free(new_with_pipe);
    14561456    mr_free(skip_these);
    1457     mr_free(dir);
    14581457
    14591458    if (dip) {
     
    15831582        if ((include_paths != NULL) && (strlen(include_paths) == 0)) {
    15841583            log_msg(1, "Including only '/' in %s", sz_filelist);
    1585             open_and_list_dir("/", exclude_paths, fout,
    1586                               time_of_last_full_backup);
     1584            open_and_list_dir("/", exclude_paths, fout, time_of_last_full_backup);
    15871585        } else {
    15881586            p = include_paths;
     
    15901588                q = next_entry(p);
    15911589                log_msg(1, "Including %s in filelist %s", q, sz_filelist);
    1592                 open_and_list_dir(q, exclude_paths, fout,
    1593                                   time_of_last_full_backup);
     1590                open_and_list_dir(q, exclude_paths, fout, time_of_last_full_backup);
    15941591                p += strlen(q);
    15951592                paranoid_free(q);
     
    16521649
    16531650    if (bkpinfo->make_filelist) {
    1654         res =
    1655             mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir,
    1656                                bkpinfo->scratchdir, bkpinfo->include_paths,
    1657                                bkpinfo->exclude_paths,
    1658                                bkpinfo->differential, NULL);
     1651        res = mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, bkpinfo->scratchdir, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);
    16591652    } else {
    1660         res =
    1661             mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir,
    1662                                bkpinfo->scratchdir, NULL,
    1663                                bkpinfo->exclude_paths,
    1664                                bkpinfo->differential,
    1665                                bkpinfo->include_paths);
     1653        res = mondo_makefilelist(MONDO_LOGFILE, bkpinfo->tmpdir, bkpinfo->scratchdir, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);
    16661654    }
    16671655
  • branches/3.2/mondo/src/common/libmondo-fork.c

    r3195 r3205  
    5151    assert_string_is_neither_NULL_nor_zerolength(call);
    5252    if ((fin = popen(call, "r"))) {
    53         for (mr_getline(tmp, fin); !feof(fin); mr_getline(tmp, fin)) {
     53        while (!feof(fin)) {
     54            mr_getline(tmp, fin);
    5455            if (strlen(tmp) > 1) {
    5556                strcpy(result, tmp);
     
    6263    }
    6364    strip_spaces(result);
    64     mr_free(tmp);
    6565    return(result);
    6666}
  • branches/3.2/mondo/src/common/libmondo-string.c

    r3194 r3205  
    9292    for (p = in_out; *p == ' '; p++);
    9393    strcpy(scratch, p);
    94     strip_spaces (scratch);
     94    strip_spaces(scratch);
    9595    len = (int) strlen(scratch);
    9696    mid = width / 2;
  • branches/3.2/mondo/src/common/libmondo-tools.c

    r3195 r3205  
    366366    assert(bkpinfo != NULL);
    367367
    368     bkpinfo->optimal_set_size =
    369         (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) *
    370         1024;
     368    bkpinfo->optimal_set_size = (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * 1024;
    371369
    372370    log_msg(1, "Post-param");
     
    383381        if (run_program_and_log_output(tmp, 3)) {
    384382            mr_free(tmp);
    385             fatal_error
    386                 ("Unable to open tape device. If you haven't specified it with -d, do so. If you already have, check your parameter. I think it's wrong.");
     383            fatal_error("Unable to open tape device. If you haven't specified it with -d, do so. If you already have, check your parameter. I think it's wrong.");
    387384        }
    388385        mr_free(tmp);
     
    451448            // -m isn't supported by growisofs, BTW...
    452449        } else {
    453             sprintf(bkpinfo->call_make_iso,
    454                     "%s %s -Z %s . 2>> _ERR_",
    455                     mondo_mkisofs_sz,
    456                     "", bkpinfo->media_device);
     450            sprintf(bkpinfo->call_make_iso, "%s %s -Z %s . 2>> _ERR_", mondo_mkisofs_sz, "", bkpinfo->media_device);
    457451        }
    458452        mr_free(mondo_mkisofs_sz);
     
    519513        if (bkpinfo->manual_cd_tray) {
    520514            if (bkpinfo->call_before_iso[0] == '\0') {
    521             sprintf(bkpinfo->call_before_iso,
    522                         "%s -o %s/"MONDO_TMPISOS" . 2>> _ERR_",
    523                         mondo_mkisofs_sz, bkpinfo->tmpdir);
    524                 } else {
     515                sprintf(bkpinfo->call_before_iso, "%s -o %s/"MONDO_TMPISOS" . 2>> _ERR_", mondo_mkisofs_sz, bkpinfo->tmpdir);
     516            } else {
    525517                mr_asprintf(call_before_iso_user, "%s", bkpinfo->call_before_iso);
    526518                sprintf(bkpinfo->call_before_iso, "( %s -o %s/"MONDO_TMPISOS" . 2>> _ERR_ ; %s )", mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user);
     
    10581050        return (0);
    10591051    } else {
    1060         mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5",
    1061                 label, config_file);
     1052        mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
    10621053        strcpy(value, call_program_and_get_last_line_of_output(command));
    10631054        mr_free(command);
  • branches/3.2/mondo/src/common/newt-specific.c

    r3194 r3205  
    417417        mr_free(bkpinfo->netfs_user);
    418418        mr_free(bkpinfo->netfs_proto);
     419        mr_free(bkpinfo->netfs_remotedir);
    419420        mr_free(bkpinfo->exclude_devs);
    420421        mr_free(bkpinfo->exclude_paths);
     
    650651        assert(b3 != NULL);
    651652
    652         mr_asprintf(blurb1,  "%s", b1);
    653         mr_asprintf(blurb2,  "%s", b2);
    654         mr_asprintf(blurb3,  "%s", b3);
     653        mr_asprintf(blurb1, "%s", b1);
     654        mr_asprintf(blurb2, "%s", b2);
     655        mr_asprintf(blurb3, "%s", b3);
    655656
    656657        strcpy(b1c, b1);
     
    964965        }
    965966        g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
    966         if ((percentage < 3 && g_isoform_old_progress < 3)
    967             || percentage > g_isoform_old_progress) {
     967        if ((percentage < 3 && g_isoform_old_progress < 3) || percentage > g_isoform_old_progress) {
    968968            g_isoform_old_progress = percentage;
    969969            mr_asprintf(timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
  • branches/3.2/mondo/src/lib/mr_mem.c

    r3185 r3205  
    7474    size_t n = 0;
    7575
     76    /*  We reached end of file, allocating empty string */
     77    if (feof(fd)) {
     78        mr_asprintf_int(lineptr, line, file, "");
     79        return;
     80    }
    7681    ret = getline(lineptr,&n,fd);
    77     if ((ret == -1) && (! feof(fd))) {
     82    if (ret == -1) {
    7883        mr_msg_int(1,line,file,"Unable to alloc memory in mr_getline\nExiting...");
    7984        mr_exit(-1,"Unable to alloc memory in mr_getline");
    80     }
    81     /*  We reached end of file, allocating empty string */
    82     if (ret == -1) {
    83         mr_asprintf_int(lineptr, line, file, "");
    8485    }
    8586}
  • branches/3.2/mondo/src/mondorestore/mondo-rstr-tools.c

    r3194 r3205  
    868868        mr_asprintf(bkpinfo->netfs_mount, "%s", value);
    869869
    870         read_cfg_var(g_mondo_cfg_file, "netfs-server-path", value);
     870        read_cfg_var(g_mondo_cfg_file, "netfs-server-path", value);
    871871        mr_free(bkpinfo->netfs_remote_dir);
    872872        mr_asprintf(bkpinfo->netfs_remote_dir, "%s", value);
Note: See TracChangeset for help on using the changeset viewer.