Changeset 3060 in MondoRescue


Ignore:
Timestamp:
Nov 10, 2012, 5:05:37 AM (11 years ago)
Author:
Bruno Cornec
Message:

r5035@localhost: bruno | 2012-11-09 03:17:01 +0100

  • Fix a compilation error and most compilation warnings
Location:
branches/3.0/mondo/src
Files:
18 edited

Legend:

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

    r3056 r3060  
    10231023    char *curr_acl_list_fname;
    10241024
    1025     struct s_bkpinfo *bkpinfo_bis;
    10261025    char *tmp;
    10271026    int res = 0, retval = 0;
     
    10411040    p_next_set_to_archive = (int *) (inbuf + 8);
    10421041    p_list_of_fileset_flags = (char *) (inbuf + 12);
    1043     bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET);
    10441042
    10451043    sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
     
    15971595
    15981596    log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir);
    1599     (void) getcwd(old_pwd, MAX_STR_LEN - 1);
     1597    tmp1 = getcwd(old_pwd, MAX_STR_LEN - 1);
    16001598    mr_asprintf(&tmp, "chmod 700 %s", bkpinfo->scratchdir);
    16011599    run_program_and_log_output(tmp, FALSE);
    16021600    paranoid_free(tmp);
    1603     (void)chdir(bkpinfo->scratchdir);
     1601    if (chdir(bkpinfo->scratchdir)) {
     1602        // FIXME
     1603    }
    16041604
    16051605    mds = media_descriptor_string(bkpinfo->backup_media_type);
     
    16601660    }
    16611661
    1662     (void)chdir(old_pwd);
     1662    if (chdir(old_pwd)) {
     1663        // FIXME
     1664    }
    16631665    if (retval) {
    16641666        log_msg(1, "WARNING - make_usb_fs returned an error");
     
    17341736    log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s",
    17351737            bkpinfo->scratchdir, destfile);
    1736     (void) getcwd(old_pwd, MAX_STR_LEN - 1);
     1738    tmp2 = getcwd(old_pwd, MAX_STR_LEN - 1);
    17371739    sprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir);
    17381740    run_program_and_log_output(tmp, FALSE);
    1739     chdir(bkpinfo->scratchdir);
     1741    if (chdir(bkpinfo->scratchdir)) {
     1742        // FIXME
     1743    }
    17401744
    17411745    if (bkpinfo->call_before_iso[0] != '\0') {
     
    17961800                /* reset error counter before trying to blank DVD */
    17971801                retval -= res;
    1798                 (void)system("sync");
     1802                paranoid_system("sync");
    17991803                pause_for_N_seconds(5, "Letting DVD drive settle");
    18001804
     
    19841988    }
    19851989
    1986     chdir(old_pwd);
     1990    if (chdir(old_pwd)) {
     1991        // FIXME
     1992    }
    19871993    if (retval) {
    19881994        log_msg(1, "WARNING - make_iso_fs returned an error");
     
    20402046    FILE *fin;
    20412047    char *p;
     2048    char *q;
    20422049
    20432050    /*@ buffers ******************************************** */
     
    20902097
    20912098    malloc_string(bigfile_fname);
    2092     for (fgets(bigfile_fname, MAX_STR_LEN, fin); !feof(fin);
    2093          fgets(bigfile_fname, MAX_STR_LEN, fin), biggie_file_number++) {
     2099    for (q = fgets(bigfile_fname, MAX_STR_LEN, fin); !feof(fin) && (q != NULL);
     2100         q = fgets(bigfile_fname, MAX_STR_LEN, fin), biggie_file_number++) {
    20942101        use_ntfsprog = FALSE;
    20952102        if (bigfile_fname[strlen(bigfile_fname) - 1] < 32) {
     
    26212628    /*@ long long ****************************************************** */
    26222629    off_t length_of_incoming_file = (off_t)0;
    2623     t_archtype type;
    26242630    va_list ap;
    26252631
     
    26432649        write_header_block_to_stream(length_of_incoming_file, curr_file,
    26442650                                     start_chr);
    2645         if (strstr(curr_file, ".afio.") || strstr(curr_file, ".star.")) {
    2646             type = fileset;
    2647         } else if (strstr(curr_file, "slice")) {
    2648             type = biggieslice;
    2649         } else {
    2650             type = other;
    2651         }
    26522651        res = write_file_to_stream_from_file(curr_file);
    26532652        retval += res;
     
    29772976    off_t totalread = (off_t)0;
    29782977    off_t totallength = (off_t)0;
    2979     off_t length;
    29802978
    29812979    /*@ int ******************************************************** */
     
    30363034        }
    30373035        mr_free(command);
    3038         (void) fgets(checksum_line, MAX_STR_LEN, fin);
     3036        tmp = fgets(checksum_line, MAX_STR_LEN, fin);
    30393037        pclose(fin);
    30403038        totallength = length_of_file (biggie_filename);
     
    30613059    paranoid_free(tmp);
    30623060
    3063     (void) fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout);
     3061    res = fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout);
    30643062    if (fout != NULL) {
    30653063        paranoid_fclose(fout);
    30663064    }
    3067     length = totallength / optimal_set_size / 1024;
    30683065    log_msg(1, "Opening in %s; slicing it and writing to CD/tape",
    30693066            file_to_openin);
     
    31103107                if (blksize > 0) {
    31113108                    totalread = totalread + blksize;
    3112                     (void) fwrite(tempblock, 1, blksize, fout);
     3109                    res = fwrite(tempblock, 1, blksize, fout);
    31133110                } else {
    31143111                    break;
     
    34173414                ("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds);
    34183415            mr_free(mds);
    3419             chdir("/");
     3416            if (chdir("/")) {
     3417                // FIXME
     3418            }
    34203419            log_it("Before calling verification of image()");
    34213420            if (bkpinfo->backup_media_type == usb) {
     
    34973496    assert(bkpinfo != NULL);
    34983497    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    3499         chdir("/");
     3498        if (chdir("/")) {
     3499            // FIXME
     3500        }
    35003501        mvaddstr_and_log_it(g_currentY, 0,
    35013502                            "Verifying archives against live filesystem");
     
    35183519            find_cdrom_device(bkpinfo->media_device, FALSE);    // replace 0,0,0 with /dev/cdrom
    35193520        }
    3520         chdir("/");
     3521        if (chdir("/")) {
     3522            // FIXME
     3523        }
    35213524        for (cdno = 1; cdno < 99 && bkpinfo->verify_data; cdno++) {
    35223525            if (cdno != g_current_media_number) {
     
    35413544        }
    35423545        mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    3543         (void)system(tmp);
     3546        res = system(tmp);
    35443547        mr_free(tmp);
    35453548
    35463549        mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    3547         (void)system(tmp);
     3550        res = system(tmp);
    35483551        mr_free(tmp);
    35493552        run_program_and_log_output("umount " MNT_CDROM, FALSE);
  • branches/3.0/mondo/src/common/libmondo-cli.c

    r2946 r3060  
    107107//    }
    108108    /*  Before erasing dirs go into a safe place */
    109     chdir("/tmp");
     109    if (chdir("/tmp")) {
     110        // FIXME
     111    }
    110112    sprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);
    111113    paranoid_system(tmp);
     
    180182    int i = 0;
    181183    int retval = 0;
    182     int percent = 0;
    183     int lastpos = 0;
    184184
    185185    /*@ buffers ** */
     
    389389                flag_val['d']);
    390390        log_to_screen(tmp);
    391         percent = 0;
    392391    }
    393392
     
    660659        }
    661660        paranoid_free(tmp1);
    662         lastpos = 0;
    663661
    664662        mr_make_devlist_from_pathlist(flag_val['E'], 'E');
     
    813811        /* Before changing remove old ones if any */
    814812        if (bkpinfo->scratchdir) {
    815             chdir("/tmp");
     813            if (chdir("/tmp")) {
     814                // FIXME
     815            }
    816816            mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir);
    817817            paranoid_system(tmp1);
  • branches/3.0/mondo/src/common/libmondo-devices.c

    r3052 r3060  
    348348    char *searchstr = NULL;
    349349    char *tmp;
     350    char *p;
    350351
    351352    /*@ ints ******************************************************* */
     
    383384    (void) build_partition_name(searchstr, drive, partno);
    384385    strcat(searchstr, " ");
    385     for (res = 0; !res && fgets(incoming, MAX_STR_LEN - 1, fin);) {
     386    for (res = 0; !res && (p = fgets(incoming, MAX_STR_LEN - 1, fin));) {
    386387        if (strstr(incoming, searchstr)) {
    387388            res = 1;
     
    677678        return (1);
    678679    }
    679     for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    680          (void)fgets(tmp, MAX_STR_LEN, fin)) {
     680    for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL);
     681         tmp1 = fgets(tmp, MAX_STR_LEN, fin)) {
    681682        p = strchr(tmp, '\'');
    682683        if (p) {
     
    711712            log_msg(4, "Cannot run 2nd command - non-fatal, fortunately");
    712713        } else {
    713             for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    714                  (void)fgets(tmp, MAX_STR_LEN, fin)) {
     714            for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL);
     715                 tmp1 = fgets(tmp, MAX_STR_LEN, fin)) {
    715716                log_msg(5, "--> '%s'", tmp);
    716717                if (tmp[0] != ' ' && tmp[1] != ' ') {
     
    915916    }
    916917
    917     sprintf(tmp, "%s", call_program_and_get_last_line_of_output
    918             ("dvdrecord -scanbus 2> /dev/null | grep \)\ \' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1")
    919         );
     918    sprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1"));
    920919    log_msg(5, "tmp = '%s'", tmp);
    921920    if (!tmp[0])
     
    959958#if linux
    960959    unsigned long long s = 0;
    961     int fileid, cylinders = 0, cylindersleft = 0;
     960    int fileid, cylinders = 0;
    962961    int cylindersize = 0;
    963962    int gotgeo = 0;
     
    10081007            if (ioctl(fileid, HDIO_GETGEO, &hdgeo) != -1) {
    10091008                if (hdgeo.cylinders && hdgeo.heads && hdgeo.sectors) {
    1010                     cylindersleft = cylinders = hdgeo.cylinders;
    10111009                    cylindersize = hdgeo.heads * hdgeo.sectors / 2;
    10121010                    outvalA = cylindersize * cylinders / 1024;
     
    10561054    char *command;
    10571055    char *format_sz;
     1056    char *p;
    10581057
    10591058    FILE *pin;
     
    10811080    } else {
    10821081        strcpy(good_formats, " ");
    1083         (void) fgets(good_formats + 1, MAX_STR_LEN - 1, pin);
    1084         if (pclose(pin)) {
     1082        p = fgets(good_formats + 1, MAX_STR_LEN - 1, pin);
     1083        if (pclose(pin) && (p != NULL)) {
    10851084            log_OS_error("Cannot pclose good formats");
    10861085        }
     
    11531152        return(FALSE);
    11541153    }
    1155     for ((void)fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    1156          (void)fgets(incoming, MAX_STR_LEN - 1, fin)) {
     1154    for (tmp = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (tmp != NULL);
     1155         tmp = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    11571156        if (strstr(incoming, device_with_space) //> incoming
    11581157            || strstr(incoming, device_with_tab))   // > incoming)
     
    25252524        if (bkpinfo->disaster_recovery) {
    25262525            sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
    2527             (void)system(command);
     2526            paranoid_system(command);
    25282527        }
    25292528        strcpy(tmp1, bkpinfo->netfs_proto);
     
    29812980    /* Before changing remove old ones if any */
    29822981    if (bkpinfo->scratchdir) {
    2983         chdir("/tmp");
     2982        if (chdir("/tmp")) {
     2983            // FIXME
     2984        }
    29842985        mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir);
    29852986        paranoid_system(tmp1);
     
    31903191    char *list_drives_cmd = NULL;
    31913192    char *current_drive;
     3193    char *tmp;
    31923194
    31933195    /*@ pointers *************************************************** */
     
    32193221    mr_free(list_drives_cmd);
    32203222
    3221     for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    3222          (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
     3223    for (tmp = fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives) && (tmp != NULL);
     3224         tmp = fgets(current_drive, MAX_STR_LEN, pdrives)) {
    32233225        strip_spaces(current_drive);
    32243226        log_it("looking at drive %s's MBR", current_drive);
     
    32613263        mr_free(list_drives_cmd);
    32623264
    3263         for ((void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);
    3264             (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {
     3265        for (tmp = fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives) && (tmp != NULL);
     3266            tmp = fgets(current_drive, MAX_STR_LEN, pdrives)) {
    32653267            strip_spaces(current_drive);
    32663268            log_it("looking at partition %s's BR", current_drive);
  • branches/3.0/mondo/src/common/libmondo-filelist.c

    r2972 r3060  
    212212    char *incoming;
    213213    char *tmp = NULL;
     214    char *p = NULL;
    214215
    215216    /*@ pointers *********************************** */
     
    259260    incoming = malloc(MAX_STR_LEN * 2);
    260261
    261     (void) fgets(incoming, MAX_STR_LEN * 2 - 1, fin);
    262     while (!feof(fin)) {
     262    p = fgets(incoming, MAX_STR_LEN * 2 - 1, fin);
     263    while (!feof(fin) && (p != NULL)) {
    263264        lino++;
    264265        i = strlen(incoming) - 1;
     
    307308            }
    308309        }
    309         (void) fgets(incoming, MAX_STR_LEN * 2 - 1, fin);
     310        p = fgets(incoming, MAX_STR_LEN * 2 - 1, fin);
    310311    }
    311312    paranoid_free(incoming);
     
    417418    FILE *pattr;
    418419    char *tmp;
     420    char *p;
     421
    419422    pattr = popen(syscall, "r");
    420423    if (!pattr) {
     
    428431    }
    429432    malloc_string(tmp);
    430     for ((void)fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr);
    431          (void)fgets(tmp, MAX_STR_LEN, pattr)) {
     433    for (p = fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr) && (p != NULL);
     434         p = fgets(tmp, MAX_STR_LEN, pattr)) {
    432435        fputs(tmp, pout);
    433436    }
     
    449452    char *strtmp = NULL;
    450453    char *tmp = NULL;
     454    char *p = NULL;
    451455    int i;
    452456
     
    465469
    466470    malloc_string(file_to_analyze);
    467     for ((void)fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin);
    468          (void)fgets(file_to_analyze, MAX_STR_LEN, fin)) {
     471    for (p = fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin) && (p != NULL);
     472         p = fgets(file_to_analyze, MAX_STR_LEN, fin)) {
    469473        i = strlen(file_to_analyze);
    470474        if (i > 0 && file_to_analyze[i - 1] < 32) {
     
    535539    int retval = 0;
    536540    int i;
    537     char *p, *q;
     541    char *p, *q, *r;
    538542    char *tmp = NULL;
    539543    FILE *pin, *pout, *faclin;
     
    607611//  printf("Hi there. Starting the loop\n");
    608612
    609     (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
    610     (void)fgets(incoming, MAX_STR_LEN, pin);
    611     while (!feof(pin) && !feof(faclin)) {
     613    r = fgets(current_subset_file, MAX_STR_LEN, faclin);
     614    r = fgets(incoming, MAX_STR_LEN, pin);
     615    while (!feof(pin) && !feof(faclin) && (r != NULL)) {
    612616//      printf("incoming = %s", incoming);
    613617
     
    640644        if (i < 0) {            // read another subset file in.
    641645            log_msg(my_depth, "Reading next subset line in\n\n");
    642             (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
     646            r = fgets(current_subset_file, MAX_STR_LEN, faclin);
    643647            continue;
    644648        }
     
    647651            fputs(incoming, pout);
    648652        }
    649         (void)fgets(incoming, MAX_STR_LEN, pin);
     653        r = fgets(incoming, MAX_STR_LEN, pin);
    650654        if (!i) {
    651655            log_msg(my_depth, "Copying master %s", q);
     
    660664                fputs(incoming, pout);
    661665            }
    662             (void)fgets(incoming, MAX_STR_LEN, pin);
     666            r = fgets(incoming, MAX_STR_LEN, pin);
    663667        }
    664668        if (!i) {
    665             (void)fgets(current_subset_file, MAX_STR_LEN, faclin);
     669            r = fgets(current_subset_file, MAX_STR_LEN, faclin);
    666670        }
    667671    }
    668672    while (!feof(pin)) {
    669         (void)fgets(incoming, MAX_STR_LEN, pin);
     673        r = fgets(incoming, MAX_STR_LEN, pin);
    670674    }
    671675    fclose(faclin);
     
    919923
    920924    open_evalcall_form("Loading filelist from disk");
    921     for ((void)fgets(fname, MAX_STR_LEN, pin); !feof(pin);
    922          (void)fgets(fname, MAX_STR_LEN, pin)) {
     925    for (tmp1 = fgets(fname, MAX_STR_LEN, pin); !feof(pin);
     926         tmp1 = fgets(fname, MAX_STR_LEN, pin)) {
    923927        if ((fname[strlen(fname) - 1] == 13
    924928             || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) {
     
    13861390        paranoid_free(find_excludes);
    13871391        log_msg(5, "find command = %s", strtmp);
    1388         (void)system(strtmp);
     1392        paranoid_system(strtmp);
    13891393        paranoid_free(strtmp);
    13901394        mr_asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
     
    15361540    char *sz_filelist, *tmp;
    15371541    char *exclude_paths = NULL;
    1538     int i;
    15391542    FILE *fout;
    15401543    char *command = NULL;
     
    16291632            fatal_error("Cannot openout to sz_filelist");
    16301633        }
    1631         i = 0;
    16321634        if (strlen(include_paths) == 0) {
    16331635            log_msg(1, "Including only '/' in %s", sz_filelist);
     
    17371739{
    17381740    /*@ int ******************************************************** */
    1739     int noof_chars;
    17401741    static int depth = 0;
    17411742    static char original_string[MAX_STR_LEN];
     
    17551756    assert(startnode != NULL);
    17561757    assert(string_to_find != NULL);
    1757 
    1758     noof_chars = strlen(string_to_find) + 1;    /* we include the '\0' */
    17591758
    17601759    log_msg(7, "starting --- str=%s", string_to_find);
     
    18251824//      fscanf(fin, "%s\n", fname);
    18261825        len = MAX_STR_LEN - 1;
    1827         (void)getline(&fname, &len, fin);   // patch by Scrub
     1826        if (getline(&fname, &len, fin)) {
     1827            // FIXME
     1828        }
    18281829        if (!use_star) {
    18291830            if (fname[0] == '/') {
     
    18791880    FILE *fin;
    18801881    char *tmp;
     1882    char *p;
    18811883    struct s_node *nod;
    18821884
     
    18871889        return (1);
    18881890    }
    1889     for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    1890          (void)fgets(tmp, MAX_STR_LEN, fin)) {
     1891    for (p = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (p != NULL);
     1892         p = fgets(tmp, MAX_STR_LEN, fin)) {
    18911893        if (!tmp[0]) {
    18921894            continue;
  • branches/3.0/mondo/src/common/libmondo-files.c

    r2921 r3060  
    5252    /*@ pointers **************************************************** */
    5353    char *p;
     54    char *q;
    5455    FILE *fin;
    5556
     
    6566        fin = popen(command, "r");
    6667        if (fin) {
    67             (void) fgets(output, MAX_STR_LEN, fin);
    68             p = strchr(output, ' ');
     68            q = fgets(output, MAX_STR_LEN, fin);
     69            if (!q) {
     70                // FIXME
     71            }
     72            q = strchr(output, ' ');
    6973            paranoid_pclose(fin);
    7074        }
     
    129133    char incoming[MAX_STR_LEN];
    130134    char tmp[MAX_STR_LEN];
     135    char *q;
    131136
    132137    /*@ long ******************************************************** */
     
    156161            noof_lines = 0;
    157162        } else {
    158             (void) fgets(incoming, MAX_STR_LEN - 1, fin);
    159             while (strlen(incoming) > 0
     163            q = fgets(incoming, MAX_STR_LEN - 1, fin);
     164            if (!q) {
     165                // FIXME
     166            }
     167            while (strlen(incoming) > 0 && (q != NULL)
    160168                   && incoming[strlen(incoming) - 1] < 32) {
    161169                incoming[strlen(incoming) - 1] = '\0';
     
    211219    char tmp[MAX_STR_LEN];
    212220    char incoming[MAX_STR_LEN];
     221    char *q;
    213222
    214223    /*@ int ********************************************************* */
     
    234243        return;
    235244    }
    236     for (fgets(incoming, MAX_STR_LEN, fin); !feof(fin);
    237          fgets(incoming, MAX_STR_LEN, fin)) {
     245    for (q = fgets(incoming, MAX_STR_LEN, fin); !feof(fin) && (q != NULL);
     246         q = fgets(incoming, MAX_STR_LEN, fin)) {
    238247        i = strlen(incoming) - 1;
    239248        if (i >= 0 && incoming[i] < 32) {
     
    497506    static char command[MAX_STR_LEN * 2];
    498507    static char tmp[MAX_STR_LEN];
     508    char *p = NULL;
    499509
    500510    /*@ pointers **************************************************** */
     
    512522    sprintf(command, "tail -n1 %s", filename);
    513523    fin = popen(command, "r");
    514     (void) fgets(output, MAX_STR_LEN, fin);
     524    p = fgets(output, MAX_STR_LEN, fin);
     525    if (p == NULL) {
     526        // FIXME
     527    }
    515528    paranoid_pclose(fin);
    516529    while (strlen(output) > 0 && output[strlen(output) - 1] < 32) {
     
    568581    char curr_cksum[1000];
    569582    char tmp[1000];
     583    char *q;
    570584
    571585    /*@ long [long] ************************************************* */
     
    596610        return (1);
    597611    }
    598     for (fgets(stub_fname, 999, fin); !feof(fin);
    599          fgets(stub_fname, 999, fin)) {
     612    for (q = fgets(stub_fname, 999, fin); !feof(fin) && (q != NULL);
     613         q = fgets(stub_fname, 999, fin)) {
    600614        if (stub_fname[(i = strlen(stub_fname) - 1)] < 32) {
    601615            stub_fname[i] = '\0';
     
    700714    /*@ buffers **************************************************** */
    701715    char incoming[MAX_STR_LEN];
     716    char *p = NULL;
    702717
    703718    /*@ end vars *************************************************** */
     
    710725        return (0);
    711726    }
    712     (void) fgets(incoming, MAX_STR_LEN - 1, fin);
    713     while (!feof(fin)) {
     727    p = fgets(incoming, MAX_STR_LEN - 1, fin);
     728    while (!feof(fin) && (p != NULL)) {
    714729        if (strstr(incoming, wildcard)) {
    715730            matches++;
    716731        }
    717         (void) fgets(incoming, MAX_STR_LEN - 1, fin);
     732        p = fgets(incoming, MAX_STR_LEN - 1, fin);
    718733    }
    719734    paranoid_fclose(fin);
     
    759774    char *comment;
    760775    char *tmp;
     776    char *q;
    761777    char *command;
    762778
     
    783799    } else {
    784800        log_msg(4, "Reading it...");
    785         for (fgets(fname, MAX_STR_LEN, fin); !feof(fin);
    786              fgets(fname, MAX_STR_LEN, fin)) {
     801        for (q = fgets(fname, MAX_STR_LEN, fin); !feof(fin) && (q != NULL);
     802             q = fgets(fname, MAX_STR_LEN, fin)) {
    787803            if (fname[strlen(fname) - 1] <= 32) {
    788804                fname[strlen(fname) - 1] = '\0';
     
    854870      llres = 0;
    855871    } else {
    856       (void) fgets(tmp, MAX_STR_LEN, fin);
     872      p = fgets(tmp, MAX_STR_LEN, fin);
    857873      paranoid_pclose(fin);
    858874      p = strchr(tmp, '\t');
     
    9911007        return (1);
    9921008    }
    993     fscanf(fin, "%s\n", contents);
     1009    res = fscanf(fin, "%s\n", contents);
    9941010    i = strlen(contents);
    9951011    if (i > 0 && contents[i - 1] < 32) {
     
    9971013    }
    9981014    paranoid_fclose(fin);
     1015    res = 0;
    9991016    return (res);
    10001017}
     
    10241041    char tmp[MAX_STR_LEN];
    10251042    char old_pwd[MAX_STR_LEN];
     1043    int res = 0;
    10261044
    10271045    mvaddstr_and_log_it(g_currentY, 0,
     
    10441062        log_it("Untarring payload %s to scratchdir %s", tmp,
    10451063               bkpinfo->scratchdir);
    1046         (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1047         chdir(bkpinfo->scratchdir);
     1064        if (getcwd(old_pwd, MAX_STR_LEN - 1)) {
     1065            // FIXME
     1066        }
     1067        if (chdir(bkpinfo->scratchdir)) {
     1068            // FIXME
     1069        }
    10481070        sprintf(command, "tar -zxvf %s", tmp);
    10491071        if (run_program_and_log_output(command, FALSE)) {
    10501072            fatal_error("Failed to untar payload");
    10511073        }
    1052         chdir(old_pwd);
     1074        if (chdir(old_pwd)) {
     1075            // FIXME
     1076        }
    10531077    }
    10541078
  • branches/3.0/mondo/src/common/libmondo-fork.c

    r3042 r3060  
    3939    static char result[MAX_STR_LEN];
    4040    char *tmp;
     41    char *p;
    4142
    4243    /*@ pointers **************************************************** */
     
    5253    assert_string_is_neither_NULL_nor_zerolength(call);
    5354    if ((fin = popen(call, "r"))) {
    54         for (fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    55              fgets(tmp, MAX_STR_LEN, fin)) {
     55        for (p = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (p != NULL);
     56             p = fgets(tmp, MAX_STR_LEN, fin)) {
    5657            if (strlen(tmp) > 1) {
    5758                strcpy(result, tmp);
     
    267268    FILE *fin;
    268269    char *p;
     270    char *q;
    269271
    270272    /*@ end vars *************************************************** */
     
    312314    fin = fopen(tmp1, "r");
    313315    if (fin) {
    314         for (fgets(incoming, MAX_STR_LEN, fin); !feof(fin); fgets(incoming, MAX_STR_LEN, fin)) {
     316        for (q = fgets(incoming, MAX_STR_LEN, fin); !feof(fin) && (q != NULL); q = fgets(incoming, MAX_STR_LEN, fin)) {
    315317            p = incoming;
    316318            while (p && *p) {
     
    562564                log_msg(1, "bytes_read_in = %ld", bytes_read_in);
    563565//      if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); }
    564                 fwrite(tmp, 1, bytes_read_in, ftmp);
     566                if (fwrite(tmp, 1, bytes_read_in, ftmp)) {
     567                    fatal_error("Can't fwrite here");
     568                }
    565569                sprintf(tmp, "I am here - %lld", (long long)ftello(fin));
    566570//    log_msg(0, tmp);
    567                 fread(tmp, 1, tmpcap, fin);
     571                if (fread(tmp, 1, tmpcap, fin)) {
     572                    fatal_error("Can't fread here");
     573                }
    568574                log_msg(0, "tmp = '%s'", tmp);
    569                 fwrite(tmp, 1, tmpcap, ftmp);
     575                if (fwrite(tmp, 1, tmpcap, ftmp)) {
     576                    fatal_error("Can't fwrite there");
     577                }
    570578                fclose(ftmp);
    571579                fatal_error("Missing terminating block");
  • branches/3.0/mondo/src/common/libmondo-mountlist.c

    r2944 r3060  
    5050    int pos = 0, npos = 0;
    5151    int res = 0;
    52     int mountpoint_copies = 0;
    5352    int device_copies = 0;
    5453    int i = 0;
     
    111110            }
    112111            /* does partition /dev/adXsYZ exist more than once in the mountlist? */
    113             for (i = 0, mountpoint_copies = 0, device_copies = 0;
     112            for (i = 0, device_copies = 0;
    114113                 i < mountlist->entries; i++) {
    115114                if (!strcmp(device, mountlist->el[i].device)) {
     
    208207            }
    209208            /* does partition /dev/adXsY exist more than once in the mountlist? */
    210             for (i = 0, mountpoint_copies = 0, device_copies = 0;
     209            for (i = 0, device_copies = 0;
    211210                 i < mountlist->entries; i++) {
    212211                if (!strcmp(device, mountlist->el[i].device)) {
     
    271270                }
    272271                /* does partition /dev/adXsYZ exist more than once in the mountlist? */
    273                 for (i = 0, mountpoint_copies = 0, device_copies = 0;
     272                for (i = 0, device_copies = 0;
    274273                     i < mountlist->entries; i++) {
    275274                    if (!strcmp(device, mountlist->el[i].device)) {
     
    372371    int pos = 0;
    373372    int res = 0;
    374     int mountpoint_copies = 0;
    375373    int device_copies = 0;
    376374    int i = 0;
     
    454452        }
    455453        /* does partition /dev/hdNX exist more than once in the mountlist? */
    456         for (i = 0, mountpoint_copies = 0, device_copies = 0;
     454        for (i = 0, device_copies = 0;
    457455             i < mountlist->entries; i++) {
    458456            if (!strcmp(device, mountlist->el[i].device)) {
     
    812810    char *tmp = NULL;
    813811    char *p = NULL;
     812    char *q = NULL;
    814813
    815814    int items = 0;
     
    827826    malloc_string(incoming);
    828827    malloc_string(siz);
    829     (void) fgets(incoming, MAX_STR_LEN - 1, fin);
     828    q = fgets(incoming, MAX_STR_LEN - 1, fin);
    830829    log_it("Loading mountlist...");
    831     while (!feof(fin)) {
     830    while (!feof(fin) && (q != NULL)) {
    832831#if linux
    833832        res = sscanf(incoming,
     
    863862                    "Ignoring %s in mountlist - not loading that line :) ",
    864863                    mountlist->el[items].device);
    865             (void) fgets(incoming, MAX_STR_LEN - 1, fin);
     864            q = fgets(incoming, MAX_STR_LEN - 1, fin);
    866865            continue;
    867866        }
     
    906905            }
    907906        }
    908         (void) fgets(incoming, MAX_STR_LEN - 1, fin);
     907        q = fgets(incoming, MAX_STR_LEN - 1, fin);
    909908    }
    910909    paranoid_fclose(fin);
  • branches/3.0/mondo/src/common/libmondo-raid.c

    r3043 r3060  
    429429    char *incoming;
    430430    char *p;
     431    char *q;
    431432
    432433    malloc_string(incoming);
     
    440441        return (1);
    441442    }
    442     for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    443          fgets(incoming, MAX_STR_LEN - 1, fin)) {
     443    for (q = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL);
     444         q = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    444445        strip_spaces(incoming);
    445446        p = strchr(incoming, ' ');
     
    810811    static char *argv[64];
    811812    char **ap;
     813    char *q;
    812814    char *line = (char *) malloc(MAX_STR_LEN);
     815
    813816    if (!line)
    814817        errx(1,
    815818             "unable to allocate %i bytes of memory for `char *line' at %s:%i",
    816819             MAX_STR_LEN, __FILE__, __LINE__);
    817     (void) fgets(line, MAX_STR_LEN, f);
    818     if (feof(f)) {
     820    q = fgets(line, MAX_STR_LEN, f);
     821    if (feof(f) && (q != NULL)) {
    819822        log_it("[GNVCL] Uh... I reached the EOF.");
    820823        return 0;
     
    10311034            mr_asprintf(&strtmp,"%s%s", device_prefix, token);
    10321035            strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63);
    1033             raidlist->el[raidlist->entries].raid_device[64] = '\0';
     1036            raidlist->el[raidlist->entries].raid_device[63] = '\0';
    10341037            mr_free(strtmp);
    10351038            mr_free(token);
  • branches/3.0/mondo/src/common/libmondo-stream.c

    r2900 r3060  
    116116    char *blk;
    117117    int i;
     118    int j;
    118119
    119120    blk = (char *) malloc(256 * 1024);
     
    131132    }
    132133    for (i = 0; i < 8 && !feof(g_tape_stream); i++) {
    133         (void) fread(blk, 1, 256 * 1024, g_tape_stream);
     134        j = fread(blk, 1, 256 * 1024, g_tape_stream);
     135        if (j) {
     136            // FIXME
     137        }
    134138    }
    135139    sleep(1);
     
    191195    }
    192196    for (i = 0; i < 4 * 8; i++) {
    193         (void) fwrite(blk, 1, 256 * 1024, g_tape_stream);
     197        if (fwrite(blk, 1, 256 * 1024, g_tape_stream)) {
     198            //FIXME
     199        }
    194200        if (should_we_write_to_next_tape
    195201            (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) {
     
    528534{
    529535    long long final_alleged_writeK, final_projected_certain_writeK,
    530         final_actually_certain_writeK = 0, cposK, bufsize_K;
     536        cposK, bufsize_K;
    531537    int last, curr, i;
    532     t_archtype type = other;
    533538    char *command = NULL;
    534539    char *tmpdir = NULL;
     
    542547    } else {
    543548        suffix[0] = '\0';
    544     }
    545     if (strstr(latest_fname, ".afio.") || strstr(latest_fname, ".star.")) {
    546         type = fileset;
    547     } else if (strstr(latest_fname, "slice")) {
    548         type = biggieslice;
    549     } else {
    550         log_it("fname = %s", latest_fname);
    551         fatal_error
    552             ("Unknown type. Internal error in maintain_collection_of_recent_archives()");
    553549    }
    554550    mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td);
     
    572568        cposK = g_tapecatalog->el[curr].tape_posK;
    573569        if (cposK < final_projected_certain_writeK) {
    574             final_actually_certain_writeK = cposK;
    575570            break;
    576571        }
     
    845840                          g_tape_stream);
    846841            }
    847             (void) fwrite(datablock, 1, (size_t) length, fout);
     842            if (fwrite(datablock, 1, (size_t) length, fout)) {
     843                // FIXME
     844            }
    848845            g_tape_posK += length / 1024;
    849846        }
     
    870867    close_evalcall_form();
    871868    log_it("Saved all.tar.gz to '%s'", outfname);
    872     (void) getcwd(old_cwd, MAX_STR_LEN);
    873     chdir(bkpinfo->tmpdir);
     869    if (getcwd(old_cwd, MAX_STR_LEN)) {
     870        // FIXME
     871    }
     872    if (chdir(bkpinfo->tmpdir)) {
     873        // FIXME
     874    }
    874875    mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null",
    875876            outfname);
     
    878879
    879880    paranoid_system("cp -f tmp/mondo-restore.cfg . 2> /dev/null");
    880     chdir(old_cwd);
     881    if (chdir(old_cwd)) {
     882        // FIXME
     883    }
    881884    unlink(outfname);
    882885    mr_free(outfname);
     
    10591062    unsigned int crctt;
    10601063
    1061     bool had_to_resync = FALSE;
    1062 
    10631064    /*@ init  ******************************************************* */
    10641065    malloc_string(temp_fname);
     
    10721073
    10731074    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
     1075    if (res) {
     1076        // FIXME
     1077    }
    10741078    if (orig_size != temp_size && orig_size != -1) {
    10751079        mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
     
    11121116            for (size = orig_size; size > where_I_was_before_tape_change;
    11131117                 size -= bytes_to_write) {
    1114                 bytes_read =
    1115                     fread(datablock, 1, bytes_to_read, g_tape_stream);
     1118                bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream);
    11161119            }
    11171120            log_msg(4, "'size' is now %lld (should be %lld)", size,
    11181121                    where_I_was_before_tape_change);
    11191122            log_to_screen("Successfully re-sync'd tape");
    1120             had_to_resync = TRUE;
    11211123            bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream);
    11221124        }
    11231125
    1124         (void) fwrite(datablock, 1, (size_t) bytes_to_write, fout); // for blocking reasons, bytes_successfully_read_in isn't necessarily the same as bytes_to_write
     1126        if (fwrite(datablock, 1, (size_t) bytes_to_write, fout)) {  // for blocking reasons, bytes_successfully_read_in isn't necessarily the same as bytes_to_write
     1127            // FIXME
     1128        }
    11251129
    11261130#ifdef EXTRA_TAPE_CHECKSUMS
     
    11971201    }
    11981202    while (!(*pcontrol_char = tempblock[7000])) {
    1199         g_tape_posK +=
    1200             fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    1201                   g_tape_stream) / 1024;
     1203        g_tape_posK += fread(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream) / 1024;
    12021204    }
    12031205/*  memcpy((char*)plength_of_incoming_file,(char*)tempblock+7001,sizeof(long long)); */
     
    13471349    ctrl_chr = -1;
    13481350    while (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    1349         res =
    1350             read_header_block_from_stream(&temp_size, temp_fname,
    1351                                           &ctrl_chr);
     1351        res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
     1352        if (res) {
     1353            // FIXME
     1354        }
    13521355        if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
    13531356            break;
     
    13581361    }
    13591362    while (ctrl_chr != BLK_START_FILE) {
    1360         res =
    1361             read_header_block_from_stream(&temp_size, temp_fname,
    1362                                           &ctrl_chr);
     1363        res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13631364        if (ctrl_chr == BLK_START_FILE) {
    13641365            break;
     
    13861387            bytes_to_write =
    13871388                (size < TAPE_BLOCK_SIZE) ? (long) size : TAPE_BLOCK_SIZE;
    1388             // FIXME - needs error-checking and -catching
    1389             fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream);
    1390         }
    1391         res =
    1392             read_header_block_from_stream(&temp_size, temp_fname,
    1393                                           &ctrl_chr);
     1389            if (fread(datablock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream)) {
     1390                // FIXME - needs error-checking and -catching
     1391            }
     1392        }
     1393        res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    13941394        if (ctrl_chr != BLK_STOP_FILE) {
    13951395            wrong_marker(BLK_STOP_FILE, ctrl_chr);
    13961396        }
    1397         res =
    1398             read_header_block_from_stream(&temp_size, temp_fname,
    1399                                           &ctrl_chr);
     1397        res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    14001398        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    14011399            wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr);
    14021400        }
    1403         res =
    1404             read_header_block_from_stream(&temp_size, temp_fname,
    1405                                           &ctrl_chr);
     1401        res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    14061402        if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    14071403            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
    14081404        }
    1409         res =
    1410             read_header_block_from_stream(&temp_size, temp_fname,
    1411                                           &ctrl_chr);
     1405        res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    14121406        if (ctrl_chr != BLK_START_FILE) {
    14131407            wrong_marker(BLK_START_FILE, ctrl_chr);
     
    14931487
    14941488    paranoid_pclose(g_tape_stream);
    1495     system("sync");
    1496     system("sync");
    1497     system("sync");
     1489    paranoid_system("sync");
     1490    paranoid_system("sync");
     1491    paranoid_system("sync");
    14981492    log_it("New tape requested.");
    14991493    insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too
     
    17301724            bytes_to_read = TAPE_BLOCK_SIZE;
    17311725        }
    1732         (void) fread(datablock, 1, (size_t) bytes_to_read, fin);
     1726        if (fread(datablock, 1, (size_t) bytes_to_read, fin)) {
     1727            // FIXME
     1728        }
    17331729        g_tape_posK +=
    17341730            fwrite(datablock, 1, /*bytes_to_read */
  • branches/3.0/mondo/src/common/libmondo-tools.c

    r3054 r3060  
    325325{
    326326#ifdef __FreeBSD__
    327     system("kldstat | grep msdosfs || kldload msdosfs 2> /dev/null");
    328     system("kldstat | grep ext2fs  || kldload ext2fs 2> /dev/null");
     327    paranoid_system("kldstat | grep msdosfs || kldload msdosfs 2> /dev/null");
     328    paranoid_system("kldstat | grep ext2fs  || kldload ext2fs 2> /dev/null");
    329329#else
    330     system("modprobe -a msdos vfat loop &> /dev/null");
     330    paranoid_system("modprobe -a msdos vfat loop &> /dev/null");
    331331#endif
    332332}
     
    747747        /* purging a potential old tmpdir */
    748748        log_it("Purging old tmpdir %s", bkpinfo->tmpdir);
    749         chdir("/tmp");
     749        if (chdir("/tmp")) {
     750            // FIXME
     751        }
    750752        mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir);
    751         (void)system(tmp);
     753        paranoid_system(tmp);
    752754        paranoid_free(tmp);
    753755    }
  • branches/3.0/mondo/src/common/libmondo-verify.c

    r3056 r3060  
    337337                            biggiestruct.filename,
    338338                            bkpinfo->tmpdir);
    339                 system(tmp);
     339                paranoid_system(tmp);
    340340                paranoid_free(tmp);
    341341
     
    445445    char *outlog;
    446446    char *tmp;
    447     //  char *p;
     447    char *p;
    448448
    449449    /*@ pointers ******************************************************* */
     
    512512        pin = popen(command, "r");
    513513        if (pin) {
    514             for (fgets(tmp, MAX_STR_LEN, pin); !feof(pin);
    515                  fgets(tmp, MAX_STR_LEN, pin)) {
     514            for (p = fgets(tmp, MAX_STR_LEN, pin); !feof(pin) && (p != NULL);
     515                 p = fgets(tmp, MAX_STR_LEN, pin)) {
    516516                if (bkpinfo->use_star) {
    517517                    if (!strstr(tmp, "diffopts=")) {
     
    724724            sprintf(tmp, "echo \"%s\" >> %s/biggies.changed",
    725725                    biggie_fname, bkpinfo->tmpdir);
    726             system(tmp);
     726            paranoid_system(tmp);
    727727        }
    728728    }
  • branches/3.0/mondo/src/common/newt-specific.c

    r2982 r3060  
    123123        /*@ buffers ********************************************************** */
    124124        int i;
     125        char *p;
    125126
    126127         assert_string_is_neither_NULL_nor_zerolength(prompt);
     
    132133
    133134            while (1) {
    134                 system("sync");
     135                paranoid_system("sync");
    135136                printf
    136137                    ("---promptdialogYN---1--- %s\n---promptdialogYN---Q--- [yes] [no] ---\n--> ",
    137138                     prompt);
    138                 (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     139                p= fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     140                if (!p) {
     141                    //FIXME
     142                }
    139143                if (tmp[strlen(tmp) - 1] == '\n')
    140144                    tmp[strlen(tmp) - 1] = '\0';
     
    151155                    return (FALSE);
    152156                } else {
    153                     system("sync");
     157                    paranoid_system("sync");
    154158                    printf
    155159                        ("Please enter either YES or NO (or yes or no, or y or n, or...)\n");
     
    172176        /*@ buffer *********************************************************** */
    173177        char *tmp;
     178        char *p;
    174179        int i;
    175180
     
    177182        assert_string_is_neither_NULL_nor_zerolength(prompt);
    178183        if (g_text_mode) {
    179             system("sync");
     184            paranoid_system("sync");
    180185            printf
    181186                ("---promptdialogOKC---1--- %s\n---promptdialogOKC---Q--- [OK] [Cancel] ---\n--> ",
    182187                 prompt);
    183             (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     188            p = fgets(tmp, MAX_NEWT_COMMENT_LEN, stdin);
     189            if (!p) {
     190                // FIXME
     191            }
    184192            if (tmp[strlen(tmp) - 1] == '\n')
    185193                tmp[strlen(tmp) - 1] = '\0';
     
    347355        */
    348356
    349         chdir("/");
     357        if (chdir("/")) {
     358            // FIXME
     359        }
    350360        if (g_selfmounted_isodir) {
    351361            sprintf(command, "umount -d %s", g_selfmounted_isodir);
     
    406416
    407417        /*  Before removing dir, make sure we're out of them */
    408         chdir("/tmp");
     418        if (chdir("/tmp")) {
     419            // FIXME
     420        }
    409421        run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
    410422        if (g_selfmounted_isodir) {
     
    432444                log_msg(8,"erasing tempdir %s",bkpinfo->tmpdir);
    433445                mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
    434                 system(command);
     446                paranoid_system(command);
    435447                mr_free(command);
    436448            }
     
    441453                log_msg(8,"erasing scratchdir %s",bkpinfo->scratchdir);
    442454                mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
    443                 system(command);
     455                paranoid_system(command);
    444456                mr_free(command);
    445457            }
     
    475487        char *command = NULL;
    476488        char *tmp = NULL;
     489        char *p = NULL;
    477490
    478491        /*@ pointers ********************************************************* */
     
    502515                for (err_log_lines[i][0] = '\0';
    503516                     strlen(err_log_lines[i]) < 2 && !feof(fin);) {
    504                     (void) fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN,
    505                                  fin);
     517                    p = fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, fin);
     518                    if (!p) {
     519                        // FIXME
     520                    }
    506521                    /* Commented to make valgrind happy and avoid crash
    507522                    strip_spaces(err_log_lines[i]);
     
    774789        /*@ buffers ********************************************************** */
    775790        char *blurb;
     791        char *p;
    776792        char *original_contents;
    777793
     
    786802                ("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n-->  ",
    787803                 title, b);
    788             (void) fgets(output, maxsize, stdin);
     804            p = fgets(output, maxsize, stdin);
     805            if (!p) {
     806                // FIXME
     807            }
    789808            if (output[strlen(output) - 1] == '\n')
    790809                output[strlen(output) - 1] = '\0';
     
    843862        /*@ buffers *********************************************************** */
    844863        char *prompt;
     864        char *q;
    845865
    846866        /*@ newt ************************************************************** */
     
    865885                                          || strcmp(prompt, button2));) {
    866886                printf("--> ");
    867                 (void) fgets(prompt, MAX_NEWT_COMMENT_LEN, stdin);
     887                q = fgets(prompt, MAX_NEWT_COMMENT_LEN, stdin);
     888                if (!q) {
     889                    // FIXME
     890                }
    868891            }
    869892            if (!strcmp(prompt, button1)) {
     
    12761299"netfs", "iso", NULL };
    12771300        char *outstr;
     1301        char *p;
    12781302        t_bkptype backup_type;
    12791303        int i;
     
    13011325                }
    13021326                printf(")\n--> ");
    1303                 (void) fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin);
     1327                p = fgets(outstr, MAX_NEWT_COMMENT_LEN, stdin);
     1328                if (!p) {
     1329                    // FIXME
     1330                }
    13041331                strip_spaces(outstr);
    13051332                for (i = 0; possible_responses[i]; i++) {
     
    14841511        bool done;
    14851512        char *tmp;
     1513        char *p;
    14861514        char *tmp1 = NULL;
    14871515        FILE *fin, *fout;
     
    15131541                break;
    15141542            }
    1515             (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, fin);
     1543            p = fgets(tmp, MAX_NEWT_COMMENT_LEN, fin);
     1544            if (!p) {
     1545                // FIXME
     1546            }
    15161547            i = (int) strlen(tmp);
    15171548            if (i < 2) {
  • branches/3.0/mondo/src/lib/mr_conf.c

    r2290 r3060  
    9797int mr_conf_open(const char *filename) {
    9898    size_t length;              /*length of the buffer/file */
    99     size_t res = 0;
    10099
    101100    /* check if mr_conf is already opened? */
     
    126125    /*reading file in buffer (skip all 0 characters) */
    127126
    128     res = fread(buffer, sizeof(char), length, CONF);
     127    if (fread(buffer, sizeof(char), length, CONF)) {
     128        // FIXME
     129    }
    129130    buffer[length] = (char) 0;  /*finalize the string */
    130131
  • branches/3.0/mondo/src/mondoarchive/mondoarchive.c

    r2982 r3060  
    441441    run_program_and_log_output("mount", 2);
    442442
    443     system("rm -f "MONDO_CACHE"/last-backup.aborted");
     443    paranoid_system("rm -f "MONDO_CACHE"/last-backup.aborted");
    444444    if (!retval) {
    445445        printf("Mondoarchive ran OK.\n");
     
    463463    log_msg(0, "Time finished: %s", mr_date());
    464464
    465     chdir("/tmp");
     465    if (chdir("/tmp")) {
     466        // FIXME
     467    }
    466468
    467469    if (!g_text_mode) {
  • branches/3.0/mondo/src/mondorestore/mondo-prep.c

    r3057 r3060  
    110110                }
    111111            }
    112             system("sync");
    113             system("sync");
    114             system("sync");
     112            paranoid_system("sync");
     113            paranoid_system("sync");
     114            paranoid_system("sync");
    115115            popup_and_OK
    116116                ("I must now reboot. Please leave the boot media in the drive and repeat your actions - e.g. type 'nuke' - and it should work fine.");
    117             system("reboot");
     117            paranoid_system("reboot");
    118118        }
    119119    }
     
    197197    char *p;
    198198    char *q;
     199    char *r;
    199200
    200201    /** int ***************************************************/
     
    272273    log_msg(1, "OK, rewound i-want-my-lvm. Doing funky stuff...");
    273274    rewind(fin);
    274     for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin); fgets(incoming, MAX_STR_LEN - 1, fin)) {
     275    for (r = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (r != NULL); r = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    275276        fgetpos(fin, &orig_pos);
    276277        if (incoming[0] != '#') {
     
    279280        if (res && strstr(command, "create") && vacuum_pack) {
    280281            sleep(2);
    281             system("sync");
    282             system("sync");
    283             system("sync");
     282            paranoid_system("sync");
     283            paranoid_system("sync");
     284            paranoid_system("sync");
    284285        }
    285286        if ((p = strstr(incoming, "vgcreate"))) {
    286287// include next line(s) if they end in /dev (cos we've got a broken i-want-my-lvm)
    287             for (fgets(tmp, MAX_STR_LEN - 1, fin); !feof(fin); fgets(tmp, MAX_STR_LEN - 1, fin)) {
     288            for (q = fgets(tmp, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL); q = fgets(tmp, MAX_STR_LEN - 1, fin)) {
    288289                if (tmp[0] == '#') {
    289290                    fsetpos(fin, &orig_pos);
     
    393394        }
    394395        sprintf(tmp, "echo \"%s\" >> /tmp/out.sh", command);
    395         system(tmp);
     396        paranoid_system(tmp);
    396397        sleep(1);
    397398    }
     
    410411    paranoid_free(vgremove_sz);
    411412//  paranoid_free(do_this_last);
    412     system("sync");
    413     system("sync");
    414     system("sync");
     413    paranoid_system("sync");
     414    paranoid_system("sync");
     415    paranoid_system("sync");
    415416    sleep(1);
    416417    log_it("ENDING");
     
    451452    /** pointers *********************************************************/
    452453    char *p;
     454    char *q;
    453455
    454456    /** init *************************************************************/
     
    480482                finish(1);
    481483            }
    482             for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin)
     484            for (q = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL)
    483485                 && !strstr(incoming, old_mountlist->el[lino].device);
    484                  fgets(incoming, MAX_STR_LEN - 1, fin));
     486                 q = fgets(incoming, MAX_STR_LEN - 1, fin));
    485487            if (!feof(fin)) {
    486488                sprintf(tmp, "Investigating %s",
    487489                        old_mountlist->el[lino].device);
    488490                log_it(tmp);
    489                 for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin)
     491                for (q = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL)
    490492                     && !strstr(incoming, "raiddev");
    491                      fgets(incoming, MAX_STR_LEN - 1, fin)) {
     493                     q = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    492494                    if (strstr(incoming, OSSWAP("device", "drive"))
    493495                        && !strchr(incoming, '#')) {
     
    778780                    "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes",
    779781                    basename(device));
    780             system(program);
     782            paranoid_system(program);
    781783            if (g_fprep) {
    782784                fprintf(g_fprep, "%s\n", program);
     
    792794
    793795                mr_asprintf(&tmp, "vinum init %s", line);
    794                 system(tmp);
     796                paranoid_system(tmp);
    795797                paranoid_free(tmp);
    796798
     
    801803
    802804                    char status[MAX_STR_LEN / 4];
    803                     fgets(status, MAX_STR_LEN / 4 - 1, pin);
     805                    if (fgets(status, MAX_STR_LEN / 4 - 1, pin)) {
     806                        // FIXME
     807                    }
    804808                    pclose(pin);
    805809
     
    823827        log_to_screen("Stopping %s", device);
    824828        stop_raid_device(device);
    825         system("sync");
     829        paranoid_system("sync");
    826830        sleep(1);
    827831        if (g_fprep) {
     
    838842            res = run_program_and_log_output(program, 1);
    839843            log_msg(1, "%s returned %d", program, res);
    840             system("sync");
     844            paranoid_system("sync");
    841845            sleep(3);
    842846            start_raid_device(device);
     
    845849            }
    846850        }
    847         system("sync");
     851        paranoid_system("sync");
    848852        sleep(2);
    849853//      log_to_screen("Starting %s", device);
     
    851855//      res = run_program_and_log_output(program, 1);
    852856//      log_msg(1, "%s returned %d", program, res);
    853 //      system("sync"); sleep(1);
    854 #endif
    855         system("sync");
     857//      paranoid_system("sync"); sleep(1);
     858#endif
     859        paranoid_system("sync");
    856860        sleep(1);
    857861        newtResume();
     
    917921    retval += res;
    918922    paranoid_free(program);
    919     system("sync");
     923    paranoid_system("sync");
    920924    sleep(1);
    921925    return (retval);
     
    973977    log_msg(1, "Stopping all RAID devices");
    974978    stop_all_raid_devices(mountlist);
    975     system("sync");
    976     system("sync");
    977     system("sync");
     979    paranoid_system("sync");
     980    paranoid_system("sync");
     981    paranoid_system("sync");
    978982    sleep(2);
    979983    log_msg(1, "Prepare soft-RAIDs");   // prep and format too
     
    9971001        }
    9981002    }
    999     system("sync");
    1000     system("sync");
    1001     system("sync");
     1003    paranoid_system("sync");
     1004    paranoid_system("sync");
     1005    paranoid_system("sync");
    10021006    sleep(2);
    10031007// This last step is probably necessary
    10041008//  log_to_screen("Re-starting software RAIDs...");
    10051009//  start_all_raid_devices(mountlist);
    1006 //  system("sync"); system("sync"); system("sync");
     1010//  paranoid_system("sync"); paranoid_system("sync"); paranoid_system("sync");
    10071011//  sleep(5);
    10081012// do LVMs now
     
    11271131                ("Please choose 'yes' to reboot and try again; or 'no' to ignore this warning and continue."))
    11281132            {
    1129                 system("sync");
    1130                 system("sync");
    1131                 system("sync");
    1132                 system("reboot");
     1133                paranoid_system("sync");
     1134                paranoid_system("sync");
     1135                paranoid_system("sync");
     1136                paranoid_system("reboot");
    11331137            }
    11341138        } else {
     
    11401144    }
    11411145    newtSuspend();
    1142     system("clear");
     1146    paranoid_system("clear");
    11431147    newtResume();
    11441148    paranoid_free(tmp);
     
    15151519    char *format;
    15161520    char *tmp;
     1521    char *tmp1 = NULL;
    15171522
    15181523    /** end *************************************************************/
     
    16341639                }
    16351640            }
    1636             system("sync");
     1641            paranoid_system("sync");
    16371642#else
    16381643            log_it("New, kernel-friendly partition remover");
     
    16951700        fput_string_one_char_at_a_time(pout_to_fdisk, "w\n");
    16961701        paranoid_pclose(pout_to_fdisk);
    1697         system("sync");
     1702        paranoid_system("sync");
    16981703        log_msg(0,"------------------- fdisk.log looks like this ------------------");
    16991704        sprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
    1700         system(tmp);
     1705        paranoid_system(tmp);
    17011706        // mark relevant partition as bootable
    17021707        mr_asprintf(&tmp1,"make-me-bootable /tmp/mountlist.txt %s noaction",drivename);
     
    17041709        mr_free(tmp1);
    17051710        log_msg(0,"------------------- end of fdisk.log...       ------------------");
    1706         system("sync");
     1711        paranoid_system("sync");
    17071712        sprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
    17081713        if (!run_program_and_log_output(tmp, 5)) {
     
    20322037    }
    20332038    newtSuspend();
    2034     system("clear");
     2039    paranoid_system("clear");
    20352040    newtResume();
    20362041    paranoid_free(drivelist);
     
    23142319    /** int *************************************************************/
    23152320    int retval = 0;
    2316 #ifndef __FreeBSD__
    2317     int res;
    2318 #endif
    23192321
    23202322    /** char ************************************************************/
     
    23282330#endif
    23292331    FILE *fin;
     2332    char *q;
    23302333    int i;
    23312334
     
    23472350            return (1);
    23482351        }
    2349         for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    2350              fgets(incoming, MAX_STR_LEN - 1, fin)) {
     2352        for (q = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL);
     2353             q = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    23512354            retval += stop_raid_device(incoming);
    23522355        }
     
    23592362            return (1);
    23602363        }
    2361         for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);
    2362              fgets(incoming, MAX_STR_LEN - 1, fin)) {
     2364        for (q = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL);
     2365             q = fgets(incoming, MAX_STR_LEN - 1, fin)) {
    23632366            for (p = incoming;
    23642367                 *p != '\0' && (*p != 'm' || *(p + 1) != 'd'
     
    23682371                for (p = dev; *p > 32; p++);
    23692372                *p = '\0';
    2370                 res = stop_raid_device(dev);
     2373                retval += stop_raid_device(dev);
    23712374            }
    23722375        }
     
    23792382    paranoid_free(dev);
    23802383    paranoid_free(incoming);
    2381     system("sync");
    2382     system("sync");
    2383     system("sync");
     2384    paranoid_system("sync");
     2385    paranoid_system("sync");
     2386    paranoid_system("sync");
    23842387    sleep(1);
    23852388    return (retval);
  • branches/3.0/mondo/src/mondorestore/mondo-rstr-compare.c

    r3056 r3060  
    9393        return (1);
    9494    }
    95     fread((void *) &biggiestruct, 1, sizeof(biggiestruct), fin);
     95    if (fread((void *) &biggiestruct, 1, sizeof(biggiestruct), fin)) {
     96        // FIXME
     97    }
    9698    paranoid_fclose(fin);
    9799
     
    134136            return (1);
    135137        } else {
    136             fgets(original_cksum_ptr, MAX_STR_LEN - 1, fin);
     138            if (fgets(original_cksum_ptr, MAX_STR_LEN - 1, fin)) {
     139                // FIXME
     140            }
    137141            paranoid_fclose(fin);
    138142            for (i = strlen(original_cksum_ptr);
     
    245249    int retval = 0;
    246250    int res;
    247     long noof_lines;
    248251    long archiver_errors;
    249252    bool use_star;
     
    265268    sprintf(filelist_name, MNT_CDROM "/archives/filelist.%d",
    266269            current_tarball_number);
    267 
    268     noof_lines = count_lines_in_file(filelist_name);
    269270
    270271    if (strstr(tarball_fname, ".bz2")) {
     
    336337                "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt",
    337338                logfile);
    338         system(command);
     339        paranoid_system(command);
    339340        archiver_errors = count_lines_in_file(logfile);
    340341    } else {
     
    372373{
    373374    int retval = 0;
    374     int res;
    375375    int current_tarball_number = 0;
    376376
     
    439439            log_to_screen(progress_str);
    440440        } else {
    441             res = compare_a_tarball(tarball_fname, current_tarball_number);
     441            retval += compare_a_tarball(tarball_fname, current_tarball_number);
    442442
    443443            g_current_progress++;
     
    490490    assert(bkpinfo != NULL);
    491491
    492     getcwd(cwd, MAX_STR_LEN - 1);
    493     chdir(bkpinfo->restore_path);
    494     getcwd(new, MAX_STR_LEN - 1);
     492    if (getcwd(cwd, MAX_STR_LEN - 1)) {
     493        // FIXME
     494    }
     495    if (chdir(bkpinfo->restore_path)) {
     496        //FIXME
     497    }
     498    if (getcwd(new, MAX_STR_LEN - 1)) {
     499        // FIXME
     500    }
    495501    insist_on_this_cd_number(g_current_media_number);
    496502    unlink(MONDO_CACHE"/changed.txt");
     
    498504    resA = compare_all_tarballs();
    499505    resB = compare_all_biggiefiles();
    500     chdir(cwd);
     506    if (chdir(cwd)) {
     507        // FIXME
     508    }
    501509    noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt");
    502510    if (noof_changed_files) {
     
    633641
    634642            log_msg(2, "calling popup_changelist_from_file()");
    635             getcwd(cwd, MAX_STR_LEN - 1);
    636             chdir(bkpinfo->restore_path);
    637             getcwd(new, MAX_STR_LEN - 1);
     643            if (getcwd(cwd, MAX_STR_LEN - 1)) {
     644                //FIXME
     645            }
     646            if (chdir(bkpinfo->restore_path)) {
     647                // FIXME
     648            }
     649            if (getcwd(new, MAX_STR_LEN - 1)) {
     650                //FIXME
     651            }
    638652            popup_changelist_from_file(MONDO_CACHE"/changed.files");
    639             chdir(cwd);
     653            if (chdir(cwd)) {
     654                // FIXME
     655            }
    640656            log_msg(2, "Returning from popup_changelist_from_file()");
    641657        }
     
    675691    malloc_string(dir);
    676692    malloc_string(command);
    677     getcwd(dir, MAX_STR_LEN);
    678     chdir(bkpinfo->restore_path);
     693    if (getcwd(dir, MAX_STR_LEN)) {
     694        // FIXME
     695    }
     696    if (chdir(bkpinfo->restore_path)) {
     697        // FIXME
     698    }
    679699
    680700    sprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp",
     
    692712    }
    693713    res = verify_tape_backups();
    694     chdir(dir);
     714    if (chdir(dir)) {
     715        // FIXME
     716    }
    695717    if (length_of_file(MONDO_CACHE"/changed.txt") > 2
    696718        && length_of_file(MONDO_CACHE"/changed.files") > 2) {
     
    733755    malloc_string(command);
    734756
    735     getcwd(dir, MAX_STR_LEN);
    736     chdir(bkpinfo->restore_path);
     757    if (getcwd(dir, MAX_STR_LEN)) {
     758        // FIXME
     759    }
     760    if (chdir(bkpinfo->restore_path)) {
     761        // FIXME
     762    }
    737763    sprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp",
    738764            bkpinfo->restore_path);
     
    741767                        0, "Verifying archives against filesystem");
    742768    res = verify_tape_backups();
    743     chdir(dir);
     769    if (chdir(dir)) {
     770        // FIXME
     771    }
    744772    if (res) {
    745773        mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
  • branches/3.0/mondo/src/mondorestore/mondo-rstr-newt.c

    r2879 r3060  
    136136    /** int **************************************************************/
    137137    int i = 0;
    138     int num_to_add = 0;
    139138
    140139    /** newt *************************************************************/
     
    231230    strcpy(drive_to_add, device_str);
    232231    for (i = strlen(drive_to_add); isdigit(drive_to_add[i - 1]); i--);
    233     num_to_add = atoi(drive_to_add + i);
    234232    drive_to_add[i] = '\0';
    235233    currline = mountlist->entries;
     
    525523
    526524    assert(raidrec != NULL);
    527     system
    528         ("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
     525    paranoid_system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    529526    strcpy(personalities,
    530527           last_line_of_file("/tmp/raid-personalities.txt"));
     
    24182415    newtComponent b2;
    24192416    newtComponent b3;
    2420     newtComponent b_res;
    24212417
    24222418
     
    24292425    myForm = newtForm(NULL, NULL, 0);
    24302426    newtFormAddComponents(myForm, b1, b2, b3, NULL);
    2431     b_res = newtRunForm(myForm);
    24322427    newtFormDestroy(myForm);
    24332428    newtPopWindow();
     
    29112906            printf
    29122907                ("Which mode - (A)utomatic, (I)nteractive, \n(C)ompare only, or (E)xit to shell?\n--> ");
    2913             fgets(tmp, MAX_STR_LEN - 1, stdin);
     2908            if (fgets(tmp, MAX_STR_LEN - 1, stdin)) {
     2909                // FIXME
     2910            }
    29142911        }
    29152912        return (output);
  • branches/3.0/mondo/src/mondorestore/mondorestore.c

    r3056 r3060  
    767767    int retval = 0;
    768768    int res = 0;
    769     bool boot_loader_installed = FALSE;
    770769  /** malloc **/
    771770    char tmp[MAX_STR_LEN];
     
    846845                log_to_screen("Preparing to format your disk(s)");
    847846                sleep(1);
    848                 system("sync");
     847                paranoid_system("sync");
    849848                log_to_screen("Please wait. This may take a few minutes.");
    850849                res += format_everything(mountlist, FALSE, raidlist);
     
    881880        log_msg(1,
    882881                "Great! Boot loader was installed. No need for msg at end.");
    883         boot_loader_installed = TRUE;
    884882    }
    885883    clean_blkid();
     
    919917    }
    920918    g_I_have_just_nuked = TRUE;
    921 /*
    922   if (!boot_loader_installed && !does_file_exist(DO_MBR_PLEASE))
    923     {
    924       log_to_screen("PLEASE RUN 'mondorestore --mbr' NOW TO INITIALIZE YOUR BOOT SECTOR");
    925       write_one_liner_data_file(DO_MBR_PLEASE, "mondorestore --mbr");
    926     }
    927 */
    928919    return (retval);
    929920}
     
    10631054        *ntfsprog_command, *suffix, *sz_devfile;
    10641055    char *bigblk;
    1065     char *p;
    10661056    char *mds = NULL;
    10671057    int retval = 0;
     
    11161106                bigfileno + 1);
    11171107        log_msg(3, tmp);
    1118         p = checksum;
    11191108    }
    11201109
     
    13441333
    13451334    if (strcmp(outfile_fname, "/dev/null")) {
    1346         chown(outfile_fname, biggiestruct.properties.st_uid,
    1347               biggiestruct.properties.st_gid);
     1335        if (chown(outfile_fname, biggiestruct.properties.st_uid,
     1336              biggiestruct.properties.st_gid)) {
     1337            // FIXME
     1338        }
    13481339        chmod(outfile_fname, biggiestruct.properties.st_mode);
    13491340        ubuf->actime = biggiestruct.properties.st_atime;
     
    16151606    if (strcmp(outfile_fname, "/dev/null")) {
    16161607        chmod(outfile_fname, biggiestruct.properties.st_mode);
    1617         chown(outfile_fname, biggiestruct.properties.st_uid,
    1618               biggiestruct.properties.st_gid);
     1608        if (chown(outfile_fname, biggiestruct.properties.st_uid,
     1609              biggiestruct.properties.st_gid)) {
     1610            // FIXME
     1611        }
    16191612        ubuf->actime = biggiestruct.properties.st_atime;
    16201613        ubuf->modtime = biggiestruct.properties.st_mtime;
     
    18311824        if (retval) {
    18321825            mr_asprintf(&command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
    1833             system(command);
     1826            paranoid_system(command);
    18341827            paranoid_free(command);
    18351828
     
    25802573    max_val = atol(tmp) + 1;
    25812574
    2582     chdir(bkpinfo->restore_path);   /* I don't know why this is needed _here_ but it seems to be. -HR, 02/04/2002 */
     2575    if (chdir(bkpinfo->restore_path)) { /* I don't know why this is needed _here_ but it seems to be. -HR, 02/04/2002 */
     2576        //FIXME
     2577    }
    25832578
    25842579    run_program_and_log_output("pwd", 5);
     
    27082703    log_msg(2, "restore_everything() --- starting");
    27092704    g_current_media_number = 1;
    2710     getcwd(cwd, MAX_STR_LEN - 1);
     2705    if (getcwd(cwd, MAX_STR_LEN - 1)) {
     2706        // FIXME
     2707    }
    27112708    sprintf(tmp, "mkdir -p %s", bkpinfo->restore_path);
    27122709    run_program_and_log_output(tmp, FALSE);
    27132710    log_msg(1, "Changing dir to %s", bkpinfo->restore_path);
    2714     chdir(bkpinfo->restore_path);
    2715     getcwd(newpath, MAX_STR_LEN - 1);
     2711    if (chdir(bkpinfo->restore_path)) {
     2712        //FIXME
     2713    }
     2714    if (getcwd(newpath, MAX_STR_LEN - 1)) {
     2715        // FIXME
     2716    }
    27162717    log_msg(1, "path is now %s", newpath);
    27172718    log_msg(1, "restoring everything");
     
    27452746        resB = restore_all_biggiefiles_from_CD(filelist);
    27462747    }
    2747     chdir(cwd);
     2748    if (chdir(cwd)) {
     2749        //FIXME
     2750    }
    27482751    if (resA + resB) {
    27492752        log_to_screen("Errors occurred while data was being restored.");
     
    29362939    if (argc == 2 && strcmp(argv[1], "--edit-mountlist") == 0) {
    29372940#ifdef __FreeBSD__
    2938         system("mv -f /tmp/raidconf.txt /etc/raidtab");
     2941        paranoid_system("mv -f /tmp/raidconf.txt /etc/raidtab");
    29392942        if (!does_file_exist("/etc/raidtab"))
    2940             system("vinum printconfig > /etc/raidtab");
     2943            paranoid_system("vinum printconfig > /etc/raidtab");
    29412944#endif
    29422945        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     
    29462949        res = let_user_edit_the_mountlist(mountlist, raidlist);
    29472950#ifdef __FreeBSD__
    2948         system("mv -f /etc/raidtab /tmp/raidconf.txt");
     2951        paranoid_system("mv -f /etc/raidtab /tmp/raidconf.txt");
    29492952#endif
    29502953        paranoid_MR_finish(res);
     
    29592962    if (argc >= 2 && strcmp(argv[1], "--pih") == 0) {
    29602963        if (system("mount | grep cdrom 2> /dev/null > /dev/null")) {
    2961             system("mount " MNT_CDROM);
     2964            paranoid_system("mount " MNT_CDROM);
    29622965        }
    29632966        bkpinfo->compression_level = 1;
     
    29692972                           "Please wait. This may take some time.",
    29702973                           "", 1999);
    2971         system("rm -Rf /tmp/*pih*");
     2974        paranoid_system("rm -Rf /tmp/*pih*");
    29722975
    29732976        restore_a_biggiefile_from_CD(42, NULL, tmp);
     
    32693272    if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) {
    32703273        sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
    3271         system(tmp);
     3274        paranoid_system(tmp);
    32723275    }
    32733276    paranoid_MR_finish(retval); // frees global stuff plus bkpinfo
Note: See TracChangeset for help on using the changeset viewer.