Changeset 3060 in MondoRescue for branches/3.0/mondo/src/common/libmondo-filelist.c
- Timestamp:
- Nov 10, 2012, 5:05:37 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.