Changeset 3060 in MondoRescue for branches/3.0/mondo/src/common
- Timestamp:
- Nov 10, 2012, 5:05:37 AM (11 years ago)
- Location:
- branches/3.0/mondo/src/common
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-archive.c
r3056 r3060 1023 1023 char *curr_acl_list_fname; 1024 1024 1025 struct s_bkpinfo *bkpinfo_bis;1026 1025 char *tmp; 1027 1026 int res = 0, retval = 0; … … 1041 1040 p_next_set_to_archive = (int *) (inbuf + 8); 1042 1041 p_list_of_fileset_flags = (char *) (inbuf + 12); 1043 bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET);1044 1042 1045 1043 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, … … 1597 1595 1598 1596 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); 1600 1598 mr_asprintf(&tmp, "chmod 700 %s", bkpinfo->scratchdir); 1601 1599 run_program_and_log_output(tmp, FALSE); 1602 1600 paranoid_free(tmp); 1603 (void)chdir(bkpinfo->scratchdir); 1601 if (chdir(bkpinfo->scratchdir)) { 1602 // FIXME 1603 } 1604 1604 1605 1605 mds = media_descriptor_string(bkpinfo->backup_media_type); … … 1660 1660 } 1661 1661 1662 (void)chdir(old_pwd); 1662 if (chdir(old_pwd)) { 1663 // FIXME 1664 } 1663 1665 if (retval) { 1664 1666 log_msg(1, "WARNING - make_usb_fs returned an error"); … … 1734 1736 log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", 1735 1737 bkpinfo->scratchdir, destfile); 1736 (void)getcwd(old_pwd, MAX_STR_LEN - 1);1738 tmp2 = getcwd(old_pwd, MAX_STR_LEN - 1); 1737 1739 sprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1738 1740 run_program_and_log_output(tmp, FALSE); 1739 chdir(bkpinfo->scratchdir); 1741 if (chdir(bkpinfo->scratchdir)) { 1742 // FIXME 1743 } 1740 1744 1741 1745 if (bkpinfo->call_before_iso[0] != '\0') { … … 1796 1800 /* reset error counter before trying to blank DVD */ 1797 1801 retval -= res; 1798 (void)system("sync");1802 paranoid_system("sync"); 1799 1803 pause_for_N_seconds(5, "Letting DVD drive settle"); 1800 1804 … … 1984 1988 } 1985 1989 1986 chdir(old_pwd); 1990 if (chdir(old_pwd)) { 1991 // FIXME 1992 } 1987 1993 if (retval) { 1988 1994 log_msg(1, "WARNING - make_iso_fs returned an error"); … … 2040 2046 FILE *fin; 2041 2047 char *p; 2048 char *q; 2042 2049 2043 2050 /*@ buffers ******************************************** */ … … 2090 2097 2091 2098 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++) { 2094 2101 use_ntfsprog = FALSE; 2095 2102 if (bigfile_fname[strlen(bigfile_fname) - 1] < 32) { … … 2621 2628 /*@ long long ****************************************************** */ 2622 2629 off_t length_of_incoming_file = (off_t)0; 2623 t_archtype type;2624 2630 va_list ap; 2625 2631 … … 2643 2649 write_header_block_to_stream(length_of_incoming_file, curr_file, 2644 2650 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 }2652 2651 res = write_file_to_stream_from_file(curr_file); 2653 2652 retval += res; … … 2977 2976 off_t totalread = (off_t)0; 2978 2977 off_t totallength = (off_t)0; 2979 off_t length;2980 2978 2981 2979 /*@ int ******************************************************** */ … … 3036 3034 } 3037 3035 mr_free(command); 3038 (void)fgets(checksum_line, MAX_STR_LEN, fin);3036 tmp = fgets(checksum_line, MAX_STR_LEN, fin); 3039 3037 pclose(fin); 3040 3038 totallength = length_of_file (biggie_filename); … … 3061 3059 paranoid_free(tmp); 3062 3060 3063 (void)fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout);3061 res = fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout); 3064 3062 if (fout != NULL) { 3065 3063 paranoid_fclose(fout); 3066 3064 } 3067 length = totallength / optimal_set_size / 1024;3068 3065 log_msg(1, "Opening in %s; slicing it and writing to CD/tape", 3069 3066 file_to_openin); … … 3110 3107 if (blksize > 0) { 3111 3108 totalread = totalread + blksize; 3112 (void)fwrite(tempblock, 1, blksize, fout);3109 res = fwrite(tempblock, 1, blksize, fout); 3113 3110 } else { 3114 3111 break; … … 3417 3414 ("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds); 3418 3415 mr_free(mds); 3419 chdir("/"); 3416 if (chdir("/")) { 3417 // FIXME 3418 } 3420 3419 log_it("Before calling verification of image()"); 3421 3420 if (bkpinfo->backup_media_type == usb) { … … 3497 3496 assert(bkpinfo != NULL); 3498 3497 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 3499 chdir("/"); 3498 if (chdir("/")) { 3499 // FIXME 3500 } 3500 3501 mvaddstr_and_log_it(g_currentY, 0, 3501 3502 "Verifying archives against live filesystem"); … … 3518 3519 find_cdrom_device(bkpinfo->media_device, FALSE); // replace 0,0,0 with /dev/cdrom 3519 3520 } 3520 chdir("/"); 3521 if (chdir("/")) { 3522 // FIXME 3523 } 3521 3524 for (cdno = 1; cdno < 99 && bkpinfo->verify_data; cdno++) { 3522 3525 if (cdno != g_current_media_number) { … … 3541 3544 } 3542 3545 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); 3544 3547 mr_free(tmp); 3545 3548 3546 3549 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); 3548 3551 mr_free(tmp); 3549 3552 run_program_and_log_output("umount " MNT_CDROM, FALSE); -
branches/3.0/mondo/src/common/libmondo-cli.c
r2946 r3060 107 107 // } 108 108 /* Before erasing dirs go into a safe place */ 109 chdir("/tmp"); 109 if (chdir("/tmp")) { 110 // FIXME 111 } 110 112 sprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir); 111 113 paranoid_system(tmp); … … 180 182 int i = 0; 181 183 int retval = 0; 182 int percent = 0;183 int lastpos = 0;184 184 185 185 /*@ buffers ** */ … … 389 389 flag_val['d']); 390 390 log_to_screen(tmp); 391 percent = 0;392 391 } 393 392 … … 660 659 } 661 660 paranoid_free(tmp1); 662 lastpos = 0;663 661 664 662 mr_make_devlist_from_pathlist(flag_val['E'], 'E'); … … 813 811 /* Before changing remove old ones if any */ 814 812 if (bkpinfo->scratchdir) { 815 chdir("/tmp"); 813 if (chdir("/tmp")) { 814 // FIXME 815 } 816 816 mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir); 817 817 paranoid_system(tmp1); -
branches/3.0/mondo/src/common/libmondo-devices.c
r3052 r3060 348 348 char *searchstr = NULL; 349 349 char *tmp; 350 char *p; 350 351 351 352 /*@ ints ******************************************************* */ … … 383 384 (void) build_partition_name(searchstr, drive, partno); 384 385 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));) { 386 387 if (strstr(incoming, searchstr)) { 387 388 res = 1; … … 677 678 return (1); 678 679 } 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)) { 681 682 p = strchr(tmp, '\''); 682 683 if (p) { … … 711 712 log_msg(4, "Cannot run 2nd command - non-fatal, fortunately"); 712 713 } 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)) { 715 716 log_msg(5, "--> '%s'", tmp); 716 717 if (tmp[0] != ' ' && tmp[1] != ' ') { … … 915 916 } 916 917 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")); 920 919 log_msg(5, "tmp = '%s'", tmp); 921 920 if (!tmp[0]) … … 959 958 #if linux 960 959 unsigned long long s = 0; 961 int fileid, cylinders = 0 , cylindersleft = 0;960 int fileid, cylinders = 0; 962 961 int cylindersize = 0; 963 962 int gotgeo = 0; … … 1008 1007 if (ioctl(fileid, HDIO_GETGEO, &hdgeo) != -1) { 1009 1008 if (hdgeo.cylinders && hdgeo.heads && hdgeo.sectors) { 1010 cylindersleft = cylinders = hdgeo.cylinders;1011 1009 cylindersize = hdgeo.heads * hdgeo.sectors / 2; 1012 1010 outvalA = cylindersize * cylinders / 1024; … … 1056 1054 char *command; 1057 1055 char *format_sz; 1056 char *p; 1058 1057 1059 1058 FILE *pin; … … 1081 1080 } else { 1082 1081 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)) { 1085 1084 log_OS_error("Cannot pclose good formats"); 1086 1085 } … … 1153 1152 return(FALSE); 1154 1153 } 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)) { 1157 1156 if (strstr(incoming, device_with_space) //> incoming 1158 1157 || strstr(incoming, device_with_tab)) // > incoming) … … 2525 2524 if (bkpinfo->disaster_recovery) { 2526 2525 sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir); 2527 (void)system(command);2526 paranoid_system(command); 2528 2527 } 2529 2528 strcpy(tmp1, bkpinfo->netfs_proto); … … 2981 2980 /* Before changing remove old ones if any */ 2982 2981 if (bkpinfo->scratchdir) { 2983 chdir("/tmp"); 2982 if (chdir("/tmp")) { 2983 // FIXME 2984 } 2984 2985 mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir); 2985 2986 paranoid_system(tmp1); … … 3190 3191 char *list_drives_cmd = NULL; 3191 3192 char *current_drive; 3193 char *tmp; 3192 3194 3193 3195 /*@ pointers *************************************************** */ … … 3219 3221 mr_free(list_drives_cmd); 3220 3222 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)) { 3223 3225 strip_spaces(current_drive); 3224 3226 log_it("looking at drive %s's MBR", current_drive); … … 3261 3263 mr_free(list_drives_cmd); 3262 3264 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)) { 3265 3267 strip_spaces(current_drive); 3266 3268 log_it("looking at partition %s's BR", current_drive); -
branches/3.0/mondo/src/common/libmondo-filelist.c
r2972 r3060 212 212 char *incoming; 213 213 char *tmp = NULL; 214 char *p = NULL; 214 215 215 216 /*@ pointers *********************************** */ … … 259 260 incoming = malloc(MAX_STR_LEN * 2); 260 261 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)) { 263 264 lino++; 264 265 i = strlen(incoming) - 1; … … 307 308 } 308 309 } 309 (void)fgets(incoming, MAX_STR_LEN * 2 - 1, fin);310 p = fgets(incoming, MAX_STR_LEN * 2 - 1, fin); 310 311 } 311 312 paranoid_free(incoming); … … 417 418 FILE *pattr; 418 419 char *tmp; 420 char *p; 421 419 422 pattr = popen(syscall, "r"); 420 423 if (!pattr) { … … 428 431 } 429 432 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)) { 432 435 fputs(tmp, pout); 433 436 } … … 449 452 char *strtmp = NULL; 450 453 char *tmp = NULL; 454 char *p = NULL; 451 455 int i; 452 456 … … 465 469 466 470 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)) { 469 473 i = strlen(file_to_analyze); 470 474 if (i > 0 && file_to_analyze[i - 1] < 32) { … … 535 539 int retval = 0; 536 540 int i; 537 char *p, *q ;541 char *p, *q, *r; 538 542 char *tmp = NULL; 539 543 FILE *pin, *pout, *faclin; … … 607 611 // printf("Hi there. Starting the loop\n"); 608 612 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)) { 612 616 // printf("incoming = %s", incoming); 613 617 … … 640 644 if (i < 0) { // read another subset file in. 641 645 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); 643 647 continue; 644 648 } … … 647 651 fputs(incoming, pout); 648 652 } 649 (void)fgets(incoming, MAX_STR_LEN, pin);653 r = fgets(incoming, MAX_STR_LEN, pin); 650 654 if (!i) { 651 655 log_msg(my_depth, "Copying master %s", q); … … 660 664 fputs(incoming, pout); 661 665 } 662 (void)fgets(incoming, MAX_STR_LEN, pin);666 r = fgets(incoming, MAX_STR_LEN, pin); 663 667 } 664 668 if (!i) { 665 (void)fgets(current_subset_file, MAX_STR_LEN, faclin);669 r = fgets(current_subset_file, MAX_STR_LEN, faclin); 666 670 } 667 671 } 668 672 while (!feof(pin)) { 669 (void)fgets(incoming, MAX_STR_LEN, pin);673 r = fgets(incoming, MAX_STR_LEN, pin); 670 674 } 671 675 fclose(faclin); … … 919 923 920 924 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)) { 923 927 if ((fname[strlen(fname) - 1] == 13 924 928 || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) { … … 1386 1390 paranoid_free(find_excludes); 1387 1391 log_msg(5, "find command = %s", strtmp); 1388 (void)system(strtmp);1392 paranoid_system(strtmp); 1389 1393 paranoid_free(strtmp); 1390 1394 mr_asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist); … … 1536 1540 char *sz_filelist, *tmp; 1537 1541 char *exclude_paths = NULL; 1538 int i;1539 1542 FILE *fout; 1540 1543 char *command = NULL; … … 1629 1632 fatal_error("Cannot openout to sz_filelist"); 1630 1633 } 1631 i = 0;1632 1634 if (strlen(include_paths) == 0) { 1633 1635 log_msg(1, "Including only '/' in %s", sz_filelist); … … 1737 1739 { 1738 1740 /*@ int ******************************************************** */ 1739 int noof_chars;1740 1741 static int depth = 0; 1741 1742 static char original_string[MAX_STR_LEN]; … … 1755 1756 assert(startnode != NULL); 1756 1757 assert(string_to_find != NULL); 1757 1758 noof_chars = strlen(string_to_find) + 1; /* we include the '\0' */1759 1758 1760 1759 log_msg(7, "starting --- str=%s", string_to_find); … … 1825 1824 // fscanf(fin, "%s\n", fname); 1826 1825 len = MAX_STR_LEN - 1; 1827 (void)getline(&fname, &len, fin); // patch by Scrub 1826 if (getline(&fname, &len, fin)) { 1827 // FIXME 1828 } 1828 1829 if (!use_star) { 1829 1830 if (fname[0] == '/') { … … 1879 1880 FILE *fin; 1880 1881 char *tmp; 1882 char *p; 1881 1883 struct s_node *nod; 1882 1884 … … 1887 1889 return (1); 1888 1890 } 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)) { 1891 1893 if (!tmp[0]) { 1892 1894 continue; -
branches/3.0/mondo/src/common/libmondo-files.c
r2921 r3060 52 52 /*@ pointers **************************************************** */ 53 53 char *p; 54 char *q; 54 55 FILE *fin; 55 56 … … 65 66 fin = popen(command, "r"); 66 67 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, ' '); 69 73 paranoid_pclose(fin); 70 74 } … … 129 133 char incoming[MAX_STR_LEN]; 130 134 char tmp[MAX_STR_LEN]; 135 char *q; 131 136 132 137 /*@ long ******************************************************** */ … … 156 161 noof_lines = 0; 157 162 } 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) 160 168 && incoming[strlen(incoming) - 1] < 32) { 161 169 incoming[strlen(incoming) - 1] = '\0'; … … 211 219 char tmp[MAX_STR_LEN]; 212 220 char incoming[MAX_STR_LEN]; 221 char *q; 213 222 214 223 /*@ int ********************************************************* */ … … 234 243 return; 235 244 } 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)) { 238 247 i = strlen(incoming) - 1; 239 248 if (i >= 0 && incoming[i] < 32) { … … 497 506 static char command[MAX_STR_LEN * 2]; 498 507 static char tmp[MAX_STR_LEN]; 508 char *p = NULL; 499 509 500 510 /*@ pointers **************************************************** */ … … 512 522 sprintf(command, "tail -n1 %s", filename); 513 523 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 } 515 528 paranoid_pclose(fin); 516 529 while (strlen(output) > 0 && output[strlen(output) - 1] < 32) { … … 568 581 char curr_cksum[1000]; 569 582 char tmp[1000]; 583 char *q; 570 584 571 585 /*@ long [long] ************************************************* */ … … 596 610 return (1); 597 611 } 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)) { 600 614 if (stub_fname[(i = strlen(stub_fname) - 1)] < 32) { 601 615 stub_fname[i] = '\0'; … … 700 714 /*@ buffers **************************************************** */ 701 715 char incoming[MAX_STR_LEN]; 716 char *p = NULL; 702 717 703 718 /*@ end vars *************************************************** */ … … 710 725 return (0); 711 726 } 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)) { 714 729 if (strstr(incoming, wildcard)) { 715 730 matches++; 716 731 } 717 (void)fgets(incoming, MAX_STR_LEN - 1, fin);732 p = fgets(incoming, MAX_STR_LEN - 1, fin); 718 733 } 719 734 paranoid_fclose(fin); … … 759 774 char *comment; 760 775 char *tmp; 776 char *q; 761 777 char *command; 762 778 … … 783 799 } else { 784 800 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)) { 787 803 if (fname[strlen(fname) - 1] <= 32) { 788 804 fname[strlen(fname) - 1] = '\0'; … … 854 870 llres = 0; 855 871 } else { 856 (void)fgets(tmp, MAX_STR_LEN, fin);872 p = fgets(tmp, MAX_STR_LEN, fin); 857 873 paranoid_pclose(fin); 858 874 p = strchr(tmp, '\t'); … … 991 1007 return (1); 992 1008 } 993 fscanf(fin, "%s\n", contents);1009 res = fscanf(fin, "%s\n", contents); 994 1010 i = strlen(contents); 995 1011 if (i > 0 && contents[i - 1] < 32) { … … 997 1013 } 998 1014 paranoid_fclose(fin); 1015 res = 0; 999 1016 return (res); 1000 1017 } … … 1024 1041 char tmp[MAX_STR_LEN]; 1025 1042 char old_pwd[MAX_STR_LEN]; 1043 int res = 0; 1026 1044 1027 1045 mvaddstr_and_log_it(g_currentY, 0, … … 1044 1062 log_it("Untarring payload %s to scratchdir %s", tmp, 1045 1063 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 } 1048 1070 sprintf(command, "tar -zxvf %s", tmp); 1049 1071 if (run_program_and_log_output(command, FALSE)) { 1050 1072 fatal_error("Failed to untar payload"); 1051 1073 } 1052 chdir(old_pwd); 1074 if (chdir(old_pwd)) { 1075 // FIXME 1076 } 1053 1077 } 1054 1078 -
branches/3.0/mondo/src/common/libmondo-fork.c
r3042 r3060 39 39 static char result[MAX_STR_LEN]; 40 40 char *tmp; 41 char *p; 41 42 42 43 /*@ pointers **************************************************** */ … … 52 53 assert_string_is_neither_NULL_nor_zerolength(call); 53 54 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)) { 56 57 if (strlen(tmp) > 1) { 57 58 strcpy(result, tmp); … … 267 268 FILE *fin; 268 269 char *p; 270 char *q; 269 271 270 272 /*@ end vars *************************************************** */ … … 312 314 fin = fopen(tmp1, "r"); 313 315 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)) { 315 317 p = incoming; 316 318 while (p && *p) { … … 562 564 log_msg(1, "bytes_read_in = %ld", bytes_read_in); 563 565 // 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 } 565 569 sprintf(tmp, "I am here - %lld", (long long)ftello(fin)); 566 570 // 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 } 568 574 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 } 570 578 fclose(ftmp); 571 579 fatal_error("Missing terminating block"); -
branches/3.0/mondo/src/common/libmondo-mountlist.c
r2944 r3060 50 50 int pos = 0, npos = 0; 51 51 int res = 0; 52 int mountpoint_copies = 0;53 52 int device_copies = 0; 54 53 int i = 0; … … 111 110 } 112 111 /* 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; 114 113 i < mountlist->entries; i++) { 115 114 if (!strcmp(device, mountlist->el[i].device)) { … … 208 207 } 209 208 /* 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; 211 210 i < mountlist->entries; i++) { 212 211 if (!strcmp(device, mountlist->el[i].device)) { … … 271 270 } 272 271 /* 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; 274 273 i < mountlist->entries; i++) { 275 274 if (!strcmp(device, mountlist->el[i].device)) { … … 372 371 int pos = 0; 373 372 int res = 0; 374 int mountpoint_copies = 0;375 373 int device_copies = 0; 376 374 int i = 0; … … 454 452 } 455 453 /* 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; 457 455 i < mountlist->entries; i++) { 458 456 if (!strcmp(device, mountlist->el[i].device)) { … … 812 810 char *tmp = NULL; 813 811 char *p = NULL; 812 char *q = NULL; 814 813 815 814 int items = 0; … … 827 826 malloc_string(incoming); 828 827 malloc_string(siz); 829 (void)fgets(incoming, MAX_STR_LEN - 1, fin);828 q = fgets(incoming, MAX_STR_LEN - 1, fin); 830 829 log_it("Loading mountlist..."); 831 while (!feof(fin) ) {830 while (!feof(fin) && (q != NULL)) { 832 831 #if linux 833 832 res = sscanf(incoming, … … 863 862 "Ignoring %s in mountlist - not loading that line :) ", 864 863 mountlist->el[items].device); 865 (void)fgets(incoming, MAX_STR_LEN - 1, fin);864 q = fgets(incoming, MAX_STR_LEN - 1, fin); 866 865 continue; 867 866 } … … 906 905 } 907 906 } 908 (void)fgets(incoming, MAX_STR_LEN - 1, fin);907 q = fgets(incoming, MAX_STR_LEN - 1, fin); 909 908 } 910 909 paranoid_fclose(fin); -
branches/3.0/mondo/src/common/libmondo-raid.c
r3043 r3060 429 429 char *incoming; 430 430 char *p; 431 char *q; 431 432 432 433 malloc_string(incoming); … … 440 441 return (1); 441 442 } 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)) { 444 445 strip_spaces(incoming); 445 446 p = strchr(incoming, ' '); … … 810 811 static char *argv[64]; 811 812 char **ap; 813 char *q; 812 814 char *line = (char *) malloc(MAX_STR_LEN); 815 813 816 if (!line) 814 817 errx(1, 815 818 "unable to allocate %i bytes of memory for `char *line' at %s:%i", 816 819 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)) { 819 822 log_it("[GNVCL] Uh... I reached the EOF."); 820 823 return 0; … … 1031 1034 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 1032 1035 strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63); 1033 raidlist->el[raidlist->entries].raid_device[6 4] = '\0';1036 raidlist->el[raidlist->entries].raid_device[63] = '\0'; 1034 1037 mr_free(strtmp); 1035 1038 mr_free(token); -
branches/3.0/mondo/src/common/libmondo-stream.c
r2900 r3060 116 116 char *blk; 117 117 int i; 118 int j; 118 119 119 120 blk = (char *) malloc(256 * 1024); … … 131 132 } 132 133 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 } 134 138 } 135 139 sleep(1); … … 191 195 } 192 196 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 } 194 200 if (should_we_write_to_next_tape 195 201 (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) { … … 528 534 { 529 535 long long final_alleged_writeK, final_projected_certain_writeK, 530 final_actually_certain_writeK = 0,cposK, bufsize_K;536 cposK, bufsize_K; 531 537 int last, curr, i; 532 t_archtype type = other;533 538 char *command = NULL; 534 539 char *tmpdir = NULL; … … 542 547 } else { 543 548 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_error552 ("Unknown type. Internal error in maintain_collection_of_recent_archives()");553 549 } 554 550 mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td); … … 572 568 cposK = g_tapecatalog->el[curr].tape_posK; 573 569 if (cposK < final_projected_certain_writeK) { 574 final_actually_certain_writeK = cposK;575 570 break; 576 571 } … … 845 840 g_tape_stream); 846 841 } 847 (void) fwrite(datablock, 1, (size_t) length, fout); 842 if (fwrite(datablock, 1, (size_t) length, fout)) { 843 // FIXME 844 } 848 845 g_tape_posK += length / 1024; 849 846 } … … 870 867 close_evalcall_form(); 871 868 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 } 874 875 mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", 875 876 outfname); … … 878 879 879 880 paranoid_system("cp -f tmp/mondo-restore.cfg . 2> /dev/null"); 880 chdir(old_cwd); 881 if (chdir(old_cwd)) { 882 // FIXME 883 } 881 884 unlink(outfname); 882 885 mr_free(outfname); … … 1059 1062 unsigned int crctt; 1060 1063 1061 bool had_to_resync = FALSE;1062 1063 1064 /*@ init ******************************************************* */ 1064 1065 malloc_string(temp_fname); … … 1072 1073 1073 1074 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1075 if (res) { 1076 // FIXME 1077 } 1074 1078 if (orig_size != temp_size && orig_size != -1) { 1075 1079 mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10); … … 1112 1116 for (size = orig_size; size > where_I_was_before_tape_change; 1113 1117 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); 1116 1119 } 1117 1120 log_msg(4, "'size' is now %lld (should be %lld)", size, 1118 1121 where_I_was_before_tape_change); 1119 1122 log_to_screen("Successfully re-sync'd tape"); 1120 had_to_resync = TRUE;1121 1123 bytes_read = fread(datablock, 1, bytes_to_read, g_tape_stream); 1122 1124 } 1123 1125 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 } 1125 1129 1126 1130 #ifdef EXTRA_TAPE_CHECKSUMS … … 1197 1201 } 1198 1202 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; 1202 1204 } 1203 1205 /* memcpy((char*)plength_of_incoming_file,(char*)tempblock+7001,sizeof(long long)); */ … … 1347 1349 ctrl_chr = -1; 1348 1350 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 } 1352 1355 if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) { 1353 1356 break; … … 1358 1361 } 1359 1362 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); 1363 1364 if (ctrl_chr == BLK_START_FILE) { 1364 1365 break; … … 1386 1387 bytes_to_write = 1387 1388 (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); 1394 1394 if (ctrl_chr != BLK_STOP_FILE) { 1395 1395 wrong_marker(BLK_STOP_FILE, ctrl_chr); 1396 1396 } 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); 1400 1398 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) { 1401 1399 wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr); 1402 1400 } 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); 1406 1402 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1407 1403 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 1408 1404 } 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); 1412 1406 if (ctrl_chr != BLK_START_FILE) { 1413 1407 wrong_marker(BLK_START_FILE, ctrl_chr); … … 1493 1487 1494 1488 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"); 1498 1492 log_it("New tape requested."); 1499 1493 insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too … … 1730 1724 bytes_to_read = TAPE_BLOCK_SIZE; 1731 1725 } 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 } 1733 1729 g_tape_posK += 1734 1730 fwrite(datablock, 1, /*bytes_to_read */ -
branches/3.0/mondo/src/common/libmondo-tools.c
r3054 r3060 325 325 { 326 326 #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"); 329 329 #else 330 system("modprobe -a msdos vfat loop &> /dev/null");330 paranoid_system("modprobe -a msdos vfat loop &> /dev/null"); 331 331 #endif 332 332 } … … 747 747 /* purging a potential old tmpdir */ 748 748 log_it("Purging old tmpdir %s", bkpinfo->tmpdir); 749 chdir("/tmp"); 749 if (chdir("/tmp")) { 750 // FIXME 751 } 750 752 mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir); 751 (void)system(tmp);753 paranoid_system(tmp); 752 754 paranoid_free(tmp); 753 755 } -
branches/3.0/mondo/src/common/libmondo-verify.c
r3056 r3060 337 337 biggiestruct.filename, 338 338 bkpinfo->tmpdir); 339 system(tmp);339 paranoid_system(tmp); 340 340 paranoid_free(tmp); 341 341 … … 445 445 char *outlog; 446 446 char *tmp; 447 //char *p;447 char *p; 448 448 449 449 /*@ pointers ******************************************************* */ … … 512 512 pin = popen(command, "r"); 513 513 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)) { 516 516 if (bkpinfo->use_star) { 517 517 if (!strstr(tmp, "diffopts=")) { … … 724 724 sprintf(tmp, "echo \"%s\" >> %s/biggies.changed", 725 725 biggie_fname, bkpinfo->tmpdir); 726 system(tmp);726 paranoid_system(tmp); 727 727 } 728 728 } -
branches/3.0/mondo/src/common/newt-specific.c
r2982 r3060 123 123 /*@ buffers ********************************************************** */ 124 124 int i; 125 char *p; 125 126 126 127 assert_string_is_neither_NULL_nor_zerolength(prompt); … … 132 133 133 134 while (1) { 134 system("sync");135 paranoid_system("sync"); 135 136 printf 136 137 ("---promptdialogYN---1--- %s\n---promptdialogYN---Q--- [yes] [no] ---\n--> ", 137 138 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 } 139 143 if (tmp[strlen(tmp) - 1] == '\n') 140 144 tmp[strlen(tmp) - 1] = '\0'; … … 151 155 return (FALSE); 152 156 } else { 153 system("sync");157 paranoid_system("sync"); 154 158 printf 155 159 ("Please enter either YES or NO (or yes or no, or y or n, or...)\n"); … … 172 176 /*@ buffer *********************************************************** */ 173 177 char *tmp; 178 char *p; 174 179 int i; 175 180 … … 177 182 assert_string_is_neither_NULL_nor_zerolength(prompt); 178 183 if (g_text_mode) { 179 system("sync");184 paranoid_system("sync"); 180 185 printf 181 186 ("---promptdialogOKC---1--- %s\n---promptdialogOKC---Q--- [OK] [Cancel] ---\n--> ", 182 187 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 } 184 192 if (tmp[strlen(tmp) - 1] == '\n') 185 193 tmp[strlen(tmp) - 1] = '\0'; … … 347 355 */ 348 356 349 chdir("/"); 357 if (chdir("/")) { 358 // FIXME 359 } 350 360 if (g_selfmounted_isodir) { 351 361 sprintf(command, "umount -d %s", g_selfmounted_isodir); … … 406 416 407 417 /* Before removing dir, make sure we're out of them */ 408 chdir("/tmp"); 418 if (chdir("/tmp")) { 419 // FIXME 420 } 409 421 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 410 422 if (g_selfmounted_isodir) { … … 432 444 log_msg(8,"erasing tempdir %s",bkpinfo->tmpdir); 433 445 mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir); 434 system(command);446 paranoid_system(command); 435 447 mr_free(command); 436 448 } … … 441 453 log_msg(8,"erasing scratchdir %s",bkpinfo->scratchdir); 442 454 mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir); 443 system(command);455 paranoid_system(command); 444 456 mr_free(command); 445 457 } … … 475 487 char *command = NULL; 476 488 char *tmp = NULL; 489 char *p = NULL; 477 490 478 491 /*@ pointers ********************************************************* */ … … 502 515 for (err_log_lines[i][0] = '\0'; 503 516 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 } 506 521 /* Commented to make valgrind happy and avoid crash 507 522 strip_spaces(err_log_lines[i]); … … 774 789 /*@ buffers ********************************************************** */ 775 790 char *blurb; 791 char *p; 776 792 char *original_contents; 777 793 … … 786 802 ("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n--> ", 787 803 title, b); 788 (void) fgets(output, maxsize, stdin); 804 p = fgets(output, maxsize, stdin); 805 if (!p) { 806 // FIXME 807 } 789 808 if (output[strlen(output) - 1] == '\n') 790 809 output[strlen(output) - 1] = '\0'; … … 843 862 /*@ buffers *********************************************************** */ 844 863 char *prompt; 864 char *q; 845 865 846 866 /*@ newt ************************************************************** */ … … 865 885 || strcmp(prompt, button2));) { 866 886 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 } 868 891 } 869 892 if (!strcmp(prompt, button1)) { … … 1276 1299 "netfs", "iso", NULL }; 1277 1300 char *outstr; 1301 char *p; 1278 1302 t_bkptype backup_type; 1279 1303 int i; … … 1301 1325 } 1302 1326 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 } 1304 1331 strip_spaces(outstr); 1305 1332 for (i = 0; possible_responses[i]; i++) { … … 1484 1511 bool done; 1485 1512 char *tmp; 1513 char *p; 1486 1514 char *tmp1 = NULL; 1487 1515 FILE *fin, *fout; … … 1513 1541 break; 1514 1542 } 1515 (void) fgets(tmp, MAX_NEWT_COMMENT_LEN, fin); 1543 p = fgets(tmp, MAX_NEWT_COMMENT_LEN, fin); 1544 if (!p) { 1545 // FIXME 1546 } 1516 1547 i = (int) strlen(tmp); 1517 1548 if (i < 2) {
Note:
See TracChangeset
for help on using the changeset viewer.