Changeset 2202 in MondoRescue


Ignore:
Timestamp:
May 13, 2009, 4:34:00 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Remove useless function look_for_weird_formats
  • Adds a test program for mountlist management to find a seg. fault bug when using a large mountlist file
Location:
branches/2.2.9/mondo
Files:
3 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/Makefile.am

    r899 r2202  
    11AUTOMAKE_OPTIONS = 1.7
    2 SUBDIRS        = src
     2SUBDIRS        = src test
    33man8_MANS      = docs/man/mondoarchive.8 docs/man/mondorestore.8
  • branches/2.2.9/mondo/configure.in

    r2195 r2202  
    125125AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr mkdtemp])
    126126
    127 AC_OUTPUT([Makefile src/Makefile src/common/Makefile src/mondoarchive/Makefile src/mondorestore/Makefile src/restore-scripts/Makefile src/restore-scripts/mondo/Makefile src/post-nuke.sample/Makefile src/post-nuke.sample/usr/Makefile src/post-nuke.sample/usr/bin/Makefile])
     127AC_OUTPUT([Makefile src/Makefile src/common/Makefile src/mondoarchive/Makefile src/mondorestore/Makefile src/restore-scripts/Makefile src/restore-scripts/mondo/Makefile src/post-nuke.sample/Makefile src/post-nuke.sample/usr/Makefile src/post-nuke.sample/usr/bin/Makefile test/Makefile])
  • branches/2.2.9/mondo/src/common/libmondo-archive.c

    r2190 r2202  
    803803    }
    804804    if (bkpinfo->backup_media_type == usb) {
    805         asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
     805        (void)asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
    806806    } else {
    807         asprintf(&tmp2," ");
     807        (void)asprintf(&tmp2," ");
    808808    }
    809809
     
    828828
    829829    if (g_getfattr) {
    830         asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
     830        (void)asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
    831831        if (write_one_liner_data_file(tmp1, "TRUE")) {
    832832            log_msg(1, "%ld: Unable to write one-liner XATTR",
     
    836836    }
    837837    if (g_getfacl) {
    838         asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
     838        (void)asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
    839839        if (write_one_liner_data_file(tmp1, "TRUE")) {
    840840            log_msg(1, "%ld: Unable to write one-liner ACL",
     
    844844    }
    845845    if (bkpinfo->use_obdr) {
    846         asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     846        (void)asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
    847847        if (write_one_liner_data_file(tmp1, "TRUE")) {
    848848            log_msg(1, "%ld: Unable to write one-liner OBDR",
     
    15811581    log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir);
    15821582    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1583     asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
     1583    (void)asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
    15841584    run_program_and_log_output(tmp, FALSE);
    15851585    paranoid_free(tmp);
    1586     chdir(bkpinfo->scratchdir);
    1587 
    1588     asprintf(&message_to_screen, "Copying data to make %s #%d",
     1586    (void)chdir(bkpinfo->scratchdir);
     1587
     1588    (void)asprintf(&message_to_screen, "Copying data to make %s #%d",
    15891589                media_descriptor_string(bkpinfo->backup_media_type),
    15901590                g_current_media_number);
    15911591    log_msg(1, message_to_screen);
    15921592
    1593     asprintf(&tmp1, "%s1", bkpinfo->media_device);
     1593    (void)asprintf(&tmp1, "%s1", bkpinfo->media_device);
    15941594    if (is_this_device_mounted(tmp1)) {
    15951595        log_msg(1, "USB device mounted. Remounting it at the right place");
    1596         asprintf(&tmp, "umount %s", tmp1);
     1596        (void)asprintf(&tmp, "umount %s", tmp1);
    15971597        run_program_and_log_output(tmp, FALSE);
    15981598        paranoid_free(tmp);
     
    16011601
    16021602    log_msg(1, "Mounting USB device.");
    1603     asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir);
    1604     asprintf(&tmp, "mkdir -p %s", tmp1);
     1603    (void)asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir);
     1604    (void)asprintf(&tmp, "mkdir -p %s", tmp1);
    16051605    run_program_and_log_output(tmp, FALSE);
    16061606    paranoid_free(tmp);
    16071607    /* Mindi always create one single parition on the USB dev */
    1608     asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
     1608    (void)asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
    16091609    run_program_and_log_output(tmp, FALSE);
    16101610    paranoid_free(tmp);
     
    16161616
    16171617        /* Command to execute */
    1618         asprintf(&tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
     1618        (void)asprintf(&tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
    16191619        res = eval_call_to_make_USB(tmp, message_to_screen);
    16201620        if (res) {
    1621             asprintf(&result_sz, "%s ...failed",tmp);
     1621            (void)asprintf(&result_sz, "%s ...failed",tmp);
    16221622        } else {
    1623             asprintf(&result_sz, "%s ...OK",tmp);
     1623            (void)asprintf(&result_sz, "%s ...OK",tmp);
    16241624        }
    16251625        log_to_screen(result_sz);
     
    16321632
    16331633    if (is_this_device_mounted(bkpinfo->media_device)) {
    1634         asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     1634        (void)asprintf(&tmp, "umount %s1", bkpinfo->media_device);
    16351635        run_program_and_log_output(tmp, FALSE);
    16361636        paranoid_free(tmp);
    16371637    }
    16381638
    1639     chdir(old_pwd);
     1639    (void)chdir(old_pwd);
    16401640    if (retval) {
    16411641        log_msg(1, "WARNING - make_usb_fs returned an error");
     
    17691769                    ("Failed to write to disk. I shall blank it and then try again.");
    17701770                sleep(5);
    1771                 system("sync");
     1771                (void)system("sync");
    17721772                pause_for_N_seconds(5, "Letting DVD drive settle");
    17731773
     
    23982398    }
    23992399
    2400     asprintf(&command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
     2400    (void)asprintf(&command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
    24012401            biggielist);
    24022402    paranoid_system(command);
    24032403    paranoid_free(command);
    24042404
    2405     asprintf(&blah, "biggielist = %s", biggielist);
     2405    (void)asprintf(&blah, "biggielist = %s", biggielist);
    24062406    log_msg(2, blah);
    24072407    paranoid_free(blah);
     
    24132413    if (g_getfattr) {
    24142414        get_fattr_list(biggielist, xattr_fname);
    2415         asprintf(&command, "cp %s %s/archives/", xattr_fname,
     2415        (void)asprintf(&command, "cp %s %s/archives/", xattr_fname,
    24162416            bkpinfo->scratchdir);
    24172417        paranoid_system(command);
     
    24202420    if (g_getfacl) {
    24212421        get_acl_list(biggielist, acl_fname);
    2422         asprintf(&command, "cp %s %s/archives/", acl_fname,
     2422        (void)asprintf(&command, "cp %s %s/archives/", acl_fname,
    24232423             bkpinfo->scratchdir);
    24242424        paranoid_system(command);
     
    24282428    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    24292429        res += write_EXAT_files_to_tape(xattr_fname, acl_fname);
    2430         asprintf(&blah, "%ld", count_lines_in_file(biggielist));
     2430        (void)asprintf(&blah, "%ld", count_lines_in_file(biggielist));
    24312431        write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES);
    24322432        paranoid_free(blah);
     
    35553555                "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files",
    35563556                MONDO_LOGFILE, MONDO_CACHE);
    3557         system(tmp);
     3557        (void)system(tmp);
    35583558
    35593559        sprintf(tmp,
    35603560                "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files",
    35613561                MONDO_LOGFILE, MONDO_CACHE);
    3562         system(tmp);
     3562        (void)system(tmp);
    35633563        run_program_and_log_output("umount " MNT_CDROM, FALSE);
    35643564//    if (bkpinfo->backup_media_type != iso && !bkpinfo->please_dont_eject_when_restoring)
  • branches/2.2.9/mondo/src/common/libmondo-cli.c

    r2190 r2202  
    14441444    /*@ ints ** */
    14451445    int opt = 0;
    1446     char tmp[MAX_STR_LEN];
     1446    char *tmp = NULL;
    14471447    int i = 0;
    14481448    int len;
     
    14671467            if (flag_set[optopt]) {
    14681468                bad_switches = TRUE;
    1469                 sprintf(tmp, "Switch -%c previously defined as %s\n", opt,
     1469                (void) asprintf(&tmp, "Switch -%c previously defined as %s\n", opt,
    14701470                        flag_val[i]);
    14711471                log_to_screen(tmp);
     1472                paranoid_free(tmp);
    14721473            } else {
    14731474                flag_set[opt] = TRUE;
     
    14831484                        if (strchr(flag_val[opt], '/')
    14841485                            && flag_val[opt][0] != '/') {
    1485                             sprintf(tmp,
     1486                            (void)asprintf(&tmp,
    14861487                                    "-%c flag --- must be absolute path --- '%s' isn't absolute",
    14871488                                    opt, flag_val[opt]);
    14881489                            log_to_screen(tmp);
     1490                            paranoid_free(tmp);
    14891491                            bad_switches = TRUE;
    14901492                        }
     
    14971499    for (i = optind; i < argc; i++) {
    14981500        bad_switches = TRUE;
    1499         sprintf(tmp, "Invalid arg -- %s\n", argv[i]);
     1501        (void)asprintf(&tmp, "Invalid arg -- %s\n", argv[i]);
    15001502        log_to_screen(tmp);
     1503        paranoid_free(tmp);
    15011504    }
    15021505    return (bad_switches);
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2190 r2202  
    664664        return (1);
    665665    }
    666     for (fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    667          fgets(tmp, MAX_STR_LEN, fin)) {
     666    for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
     667         (void)fgets(tmp, MAX_STR_LEN, fin)) {
    668668        p = strchr(tmp, '\'');
    669669        if (p) {
     
    698698            log_msg(4, "Cannot run 2nd command - non-fatal, fortunately");
    699699        } else {
    700             for (fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    701                  fgets(tmp, MAX_STR_LEN, fin)) {
     700            for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
     701                 (void)fgets(tmp, MAX_STR_LEN, fin)) {
    702702                log_msg(5, "--> '%s'", tmp);
    703703                if (tmp[0] != ' ' && tmp[1] != ' ') {
     
    11411141        return (FALSE);
    11421142    }
    1143     for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    1144          fgets(incoming, MAX_STR_LEN - 1, fin)) {
     1143    for ((void)fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
     1144         (void)fgets(incoming, MAX_STR_LEN - 1, fin)) {
    11451145        if (strstr(incoming, device_with_space) //> incoming
    11461146            || strstr(incoming, device_with_tab))   // > incoming)
     
    13991399        }
    14001400        sprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
    1401         system(tmp);
     1401        (void)system(tmp);
    14021402        sprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    14031403                bkpinfo->nfs_remote_dir, bkpinfo->prefix,
     
    18131813        if (bkpinfo->disaster_recovery) {
    18141814            sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
    1815             system(command);
     1815            (void)system(command);
    18161816            if (!popup_and_get_string
    18171817                ("NFS share", "Which remote NFS share should I mount?",
     
    24522452        return ('\0');
    24532453    }
    2454     for (fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    2455          fgets(current_drive, MAX_STR_LEN, pdrives)) {
     2454    for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
     2455         (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
    24562456        strip_spaces(current_drive);
    24572457        log_it("looking at drive %s's MBR", current_drive);
     
    24902490            return ('\0');
    24912491        }
    2492         for (fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    2493             fgets(current_drive, MAX_STR_LEN, pdrives)) {
     2492        for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
     2493            (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
    24942494            strip_spaces(current_drive);
    24952495            log_it("looking at partition %s's BR", current_drive);
  • branches/2.2.9/mondo/src/common/libmondo-filelist.c

    r2201 r2202  
    440440    }
    441441    malloc_string(tmp);
    442     for (fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr);
    443          fgets(tmp, MAX_STR_LEN, pattr)) {
     442    for ((void)fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr);
     443         (void)fgets(tmp, MAX_STR_LEN, pattr)) {
    444444        fputs(tmp, pout);
    445445    }
     
    476476    }
    477477    malloc_string(file_to_analyze);
    478     for (fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin);
    479          fgets(file_to_analyze, MAX_STR_LEN, fin)) {
     478    for ((void)fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin);
     479         (void)fgets(file_to_analyze, MAX_STR_LEN, fin)) {
    480480        i = strlen(file_to_analyze);
    481481        if (i > 0 && file_to_analyze[i - 1] < 32) {
     
    484484        log_msg(8, "Analyzing %s", file_to_analyze);
    485485        tmp = mr_stresc(file_to_analyze, "`$\\\"()\'|", '\\');
    486         asprintf(&strtmp, syscall_sprintf, tmp);
     486        (void)asprintf(&strtmp, syscall_sprintf, tmp);
    487487        paranoid_free(tmp);
    488         asprintf(&syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE);
     488        (void)asprintf(&syscall, "%s 2>> /dev/null", strtmp);   // " MONDO_LOGFILE);
    489489        paranoid_free(strtmp);
    490490        call_exe_and_pipe_output_to_fd(syscall, pout);
     
    609609//  printf("Hi there. Starting the loop\n");
    610610
    611     fgets(current_subset_file, MAX_STR_LEN, faclin);
    612     fgets(incoming, MAX_STR_LEN, pin);
     611    (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
     612    (void)fgets(incoming, MAX_STR_LEN, pin);
    613613    while (!feof(pin) && !feof(faclin)) {
    614614//      printf("incoming = %s", incoming);
     
    642642        if (i < 0) {            // read another subset file in.
    643643            log_msg(my_depth, "Reading next subset line in\n\n");
    644             fgets(current_subset_file, MAX_STR_LEN, faclin);
     644            (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
    645645            continue;
    646646        }
     
    649649            fputs(incoming, pout);
    650650        }
    651         fgets(incoming, MAX_STR_LEN, pin);
     651        (void)fgets(incoming, MAX_STR_LEN, pin);
    652652        if (!i) {
    653653            log_msg(my_depth, "Copying master %s", q);
     
    662662                fputs(incoming, pout);
    663663            }
    664             fgets(incoming, MAX_STR_LEN, pin);
     664            (void)fgets(incoming, MAX_STR_LEN, pin);
    665665        }
    666666        if (!i) {
    667             fgets(current_subset_file, MAX_STR_LEN, faclin);
     667            (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
    668668        }
    669669    }
    670670    while (!feof(pin)) {
    671         fgets(incoming, MAX_STR_LEN, pin);
     671        (void)fgets(incoming, MAX_STR_LEN, pin);
    672672    }
    673673    fclose(faclin);
     
    916916    }
    917917    open_evalcall_form("Loading filelist from disk");
    918     for (fgets(fname, MAX_STR_LEN, pin); !feof(pin);
    919          fgets(fname, MAX_STR_LEN, pin)) {
     918    for ((void)fgets(fname, MAX_STR_LEN, pin); !feof(pin);
     919         (void)fgets(fname, MAX_STR_LEN, pin)) {
    920920        if ((fname[strlen(fname) - 1] == 13
    921921             || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) {
     
    13891389        malloc_string(name_of_evalcall_form);
    13901390        malloc_string(find_skeleton_marker);
    1391         asprintf(&find_excludes, " ");
     1391        (void)asprintf(&find_excludes, " ");
    13921392        while((token = mr_strtok (sth, delims, &lastpos))) {
    1393           asprintf(&strtmp,"%s", find_excludes);
     1393          (void)asprintf(&strtmp,"%s", find_excludes);
    13941394          paranoid_free(find_excludes);
    1395           asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);
     1395          (void)asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);
    13961396          paranoid_free(strtmp);
    13971397          paranoid_free(token);
     
    13991399#if linux
    14001400        // 2.6 has /sys as a proc-type thing -- must be excluded
    1401         asprintf(&strtmp,
     1401        (void)asprintf(&strtmp,
    14021402             "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null",
    14031403             dir, find_excludes, g_skeleton_filelist);
    14041404#else
    14051405        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1406         asprintf(&strtmp,
     1406        (void)asprintf(&strtmp,
    14071407             "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null",
    14081408                dir, find_excludes, g_skeleton_filelist);
     
    14101410        paranoid_free(find_excludes);
    14111411        log_msg(5, "find command = %s", strtmp);
    1412         system(strtmp);
     1412        (void)system(strtmp);
    14131413        paranoid_free(strtmp);
    1414         asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
     1414        (void)asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    14151415        g_skeleton_entries =
    14161416            1 + atol(call_program_and_get_last_line_of_output(tmp));
     
    14421442#ifndef _XWIN
    14431443                if (!g_text_mode) {
    1444                     asprintf(&tmp, "Reading %-68s", dir);
     1444                    (void)asprintf(&tmp, "Reading %-68s", dir);
    14451445                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    14461446                    paranoid_free(tmp);
     
    14561456//  log_msg(0, "Cataloguing %s", dir);
    14571457    if (sth[0] == ' ') {
    1458         asprintf(&skip_these, "%s", sth);
     1458        (void)asprintf(&skip_these, "%s", sth);
    14591459    } else {
    1460         asprintf(&skip_these, " %s ", sth);
    1461     }
    1462     asprintf(&new_with_spaces, " %s ", dir);
     1460        (void)asprintf(&skip_these, " %s ", sth);
     1461    }
     1462    (void)asprintf(&new_with_spaces, " %s ", dir);
    14631463    if ((dip = opendir(dir)) == NULL) {
    1464         asprintf(&tmp,"opendir %s", dir);
     1464        (void)asprintf(&tmp,"opendir %s", dir);
    14651465        log_OS_error(tmp);
    14661466        paranoid_free(tmp);
     
    14721472            i++;
    14731473            if (strcmp(dir, "/")) {
    1474                 asprintf(&new,"%s/%s",dir,dit->d_name);
     1474                (void)asprintf(&new,"%s/%s",dir,dit->d_name);
    14751475            } else {
    1476                 asprintf(&new,"%s%s",dir,dit->d_name);
     1476                (void)asprintf(&new,"%s%s",dir,dit->d_name);
    14771477            }
    14781478            paranoid_free(new_with_spaces);
    1479             asprintf(&new_with_spaces, " %s ", new);
     1479            (void)asprintf(&new_with_spaces, " %s ", new);
    14801480            if (strstr(skip_these, new_with_spaces)) {
    14811481                fprintf(fout, "%s\n", new);
     
    14961496                                counter = 0;
    14971497                                uberctr++;
    1498                                 asprintf(&tmp, " %c ",
     1498                                (void)asprintf(&tmp, " %c ",
    14991499                                        special_dot_char(uberctr));
    15001500#ifndef _XWIN
     
    15501550    bool in_quotes = FALSE;
    15511551
    1552     asprintf(&sz_res, "%s", incoming);
     1552    (void)asprintf(&sz_res, "%s", incoming);
    15531553    p = sz_res;
    15541554    while ((*p != ' ' || in_quotes) && *p != '\0') {
     
    15981598        fatal_error("Cannot malloc exclude_paths");
    15991599    }
    1600     asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
     1600    (void)asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    16011601    if (!include_paths && !userdef_filelist) {
    16021602        fatal_error
     
    16061606    sprintf(command, "mkdir -p %s/archives", scratchdir);
    16071607    paranoid_system(command);
    1608     asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);
     1608    (void)asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);
    16091609    make_hole_for_file(sz_filelist);
    16101610
     
    16461646        log_msg(2, "include_paths = '%s'", include_paths);
    16471647        log_msg(1, "Calculating filelist");
    1648         asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1648        (void)asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
    16491649        if (strlen(tmp2) < 1) {
    1650             asprintf(&tmp1," ");
     1650            (void)asprintf(&tmp1," ");
    16511651        } else {
    16521652            log_msg(2, "Found windows FS: %s",tmp2);
    1653             asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1653            (void)asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    16541654            paranoid_free(tmp2);
    1655             asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1655            (void)asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    16561656            log_msg(2, "Found windows files: %s",tmp2);
    16571657        }
     
    18131813//      fscanf(fin, "%s\n", fname);
    18141814        len = MAX_STR_LEN - 1;
    1815         getline(&fname, &len, fin); // patch by Scrub
     1815        (void)getline(&fname, &len, fin);   // patch by Scrub
    18161816        if (!use_star) {
    18171817            if (fname[0] == '/') {
     
    18831883        return (1);
    18841884    }
    1885     for (fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    1886          fgets(tmp, MAX_STR_LEN, fin)) {
     1885    for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
     1886         (void)fgets(tmp, MAX_STR_LEN, fin)) {
    18871887        if (!tmp[0]) {
    18881888            continue;
  • branches/2.2.9/mondo/src/common/libmondo-mountlist-EXT.h

    r1295 r2202  
    88extern int look_for_duplicate_mountpoints(struct mountlist_itself
    99                                          *mountlist, char *flaws_str);
    10 extern int look_for_weird_formats(struct mountlist_itself *mountlist,
    11                                   char *flaws_str);
    1210extern int make_list_of_drives_in_mountlist(struct mountlist_itself *,
    1311                                            struct list_of_disks *);
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.c

    r2125 r2202  
    508508    /*@ buffer *********************************************************** */
    509509    struct list_of_disks *drivelist;
    510     char *tmp;
    511     char *flaws_str;
     510    char *tmp = NULL;
     511    char *flaws_str = NULL;
    512512
    513513    /*@ int ************************************************************** */
     
    547547    }
    548548    res += look_for_duplicate_mountpoints(mountlist, flaws_str);
    549 /*  res+=look_for_weird_formats(mountlist,flaws_str); .. not necessary, now that we can check to see
    550  which formarts are actually _supported_ by the kernel */
    551     /* log_it(flaws_str); */
    552549    return (spread_flaws_across_three_lines
    553550            (flaws_str, flaws_str_A, flaws_str_B, flaws_str_C, res));
     
    644641    return (res);
    645642}
    646 
    647 /**
    648  * Look for strange formats. Does not respect /proc/filesystems.
    649  * @param mountlist The mountlist to check.
    650  * @param flaws_str The flaws string to append the results to.
    651  * @return The number of weird formats found, or 0 for success.
    652  * @bug Seems orphaned; please remove.
    653  */
    654 int
    655 look_for_weird_formats(struct mountlist_itself *mountlist, char *flaws_str)
    656 {
    657 
    658     /*@ int ************************************************************* */
    659     int i = 0;
    660     int res = 0;
    661 
    662     /*@ buffers ********************************************************* */
    663     char *tmp;
    664     char *format_sz;
    665 
    666     malloc_string(tmp);
    667     malloc_string(format_sz);
    668 
    669     assert(mountlist != NULL);
    670     assert(flaws_str != NULL);
    671 
    672     for (i = 0; i < mountlist->entries; i++) {
    673         sprintf(format_sz, " %s ", mountlist->el[i].format);
    674         if (!strstr(SANE_FORMATS, format_sz)
    675             && strcmp(mountlist->el[i].mountpoint, "image") != 0) {
    676             sprintf(tmp, " %s has unknown format.",
    677                     mountlist->el[i].device);
    678             log_it(tmp);
    679             strcat(flaws_str, tmp);
    680             res++;
    681         } else if ((!strcmp(mountlist->el[i].format, "swap")
    682                     && strcmp(mountlist->el[i].mountpoint, "swap")
    683                     && strcmp(mountlist->el[i].mountpoint, "none"))
    684                    || (strcmp(mountlist->el[i].format, "swap")
    685                        && !strcmp(mountlist->el[i].mountpoint, "swap")
    686                        && !strcmp(mountlist->el[i].mountpoint, "none"))) {
    687             sprintf(tmp, " %s is half-swap.", mountlist->el[i].device);
    688             log_it(tmp);
    689             strcat(flaws_str, tmp);
    690             res++;
    691         }
    692     }
    693     paranoid_free(tmp);
    694     paranoid_free(format_sz);
    695     return (res);
    696 }
    697 
    698643
    699644
  • branches/2.2.9/mondo/src/common/libmondo-mountlist.h

    r1295 r2202  
    1111int look_for_duplicate_mountpoints(struct mountlist_itself *mountlist,
    1212                                   char *flaws_str);
    13 int look_for_weird_formats(struct mountlist_itself *mountlist,
    14                            char *flaws_str);
    1513int make_list_of_drives_in_mountlist(struct mountlist_itself *,
    1614                                     struct list_of_disks *);
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-newt.h

    r1930 r2202  
    149149void log_to_screen(const char *fmt, ...);
    150150int look_for_duplicate_mountpoints(struct mountlist_itself *, char *);
    151 int look_for_weird_formats(struct mountlist_itself *, char *);
    152151void make_list_of_unallocated_raid_partitions(struct mountlist_itself *,
    153152                                              struct mountlist_itself *,
  • branches/2.2.9/mondo/src/mondorestore/mondorestore.c

    r2144 r2202  
    28802880    run_program_and_log_output("mkdir -p " MNT_CDROM, FALSE);
    28812881
    2882     malloc_string(tmp);
    28832882    malloc_string(a);
    28842883    malloc_string(b);
     
    29262925
    29272926    /* Init GUI */
    2928     malloc_libmondo_global_strings();
    29292927    setup_newt_stuff();         /* call newtInit and setup screen log */
    29302928    welcome_to_mondorestore();
     
    29552953    }
    29562954
    2957     g_loglevel = DEFAULT_MR_LOGLEVEL;
    29582955    if (argc == 3 && strcmp(argv[1], "--echo-to-screen") == 0) {
    29592956        fout = fopen("/tmp/out.txt", "w");
Note: See TracChangeset for help on using the changeset viewer.