Changeset 2202 in MondoRescue for branches/2.2.9/mondo/src/common/libmondo-filelist.c
- Timestamp:
- May 13, 2009, 4:34:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/libmondo-filelist.c
r2201 r2202 440 440 } 441 441 malloc_string(tmp); 442 for ( fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr);443 fgets(tmp, MAX_STR_LEN, pattr)) {442 for ((void)fgets(tmp, MAX_STR_LEN, pattr); !feof(pattr); 443 (void)fgets(tmp, MAX_STR_LEN, pattr)) { 444 444 fputs(tmp, pout); 445 445 } … … 476 476 } 477 477 malloc_string(file_to_analyze); 478 for ( fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin);479 fgets(file_to_analyze, MAX_STR_LEN, fin)) {478 for ((void)fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin); 479 (void)fgets(file_to_analyze, MAX_STR_LEN, fin)) { 480 480 i = strlen(file_to_analyze); 481 481 if (i > 0 && file_to_analyze[i - 1] < 32) { … … 484 484 log_msg(8, "Analyzing %s", file_to_analyze); 485 485 tmp = mr_stresc(file_to_analyze, "`$\\\"()\'|", '\\'); 486 asprintf(&strtmp, syscall_sprintf, tmp);486 (void)asprintf(&strtmp, syscall_sprintf, tmp); 487 487 paranoid_free(tmp); 488 asprintf(&syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE);488 (void)asprintf(&syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE); 489 489 paranoid_free(strtmp); 490 490 call_exe_and_pipe_output_to_fd(syscall, pout); … … 609 609 // printf("Hi there. Starting the loop\n"); 610 610 611 fgets(current_subset_file, MAX_STR_LEN, faclin);612 fgets(incoming, MAX_STR_LEN, pin);611 (void)fgets(current_subset_file, MAX_STR_LEN, faclin); 612 (void)fgets(incoming, MAX_STR_LEN, pin); 613 613 while (!feof(pin) && !feof(faclin)) { 614 614 // printf("incoming = %s", incoming); … … 642 642 if (i < 0) { // read another subset file in. 643 643 log_msg(my_depth, "Reading next subset line in\n\n"); 644 fgets(current_subset_file, MAX_STR_LEN, faclin);644 (void)fgets(current_subset_file, MAX_STR_LEN, faclin); 645 645 continue; 646 646 } … … 649 649 fputs(incoming, pout); 650 650 } 651 fgets(incoming, MAX_STR_LEN, pin);651 (void)fgets(incoming, MAX_STR_LEN, pin); 652 652 if (!i) { 653 653 log_msg(my_depth, "Copying master %s", q); … … 662 662 fputs(incoming, pout); 663 663 } 664 fgets(incoming, MAX_STR_LEN, pin);664 (void)fgets(incoming, MAX_STR_LEN, pin); 665 665 } 666 666 if (!i) { 667 fgets(current_subset_file, MAX_STR_LEN, faclin);667 (void)fgets(current_subset_file, MAX_STR_LEN, faclin); 668 668 } 669 669 } 670 670 while (!feof(pin)) { 671 fgets(incoming, MAX_STR_LEN, pin);671 (void)fgets(incoming, MAX_STR_LEN, pin); 672 672 } 673 673 fclose(faclin); … … 916 916 } 917 917 open_evalcall_form("Loading filelist from disk"); 918 for ( fgets(fname, MAX_STR_LEN, pin); !feof(pin);919 fgets(fname, MAX_STR_LEN, pin)) {918 for ((void)fgets(fname, MAX_STR_LEN, pin); !feof(pin); 919 (void)fgets(fname, MAX_STR_LEN, pin)) { 920 920 if ((fname[strlen(fname) - 1] == 13 921 921 || fname[strlen(fname) - 1] == 10) && strlen(fname) > 0) { … … 1389 1389 malloc_string(name_of_evalcall_form); 1390 1390 malloc_string(find_skeleton_marker); 1391 asprintf(&find_excludes, " ");1391 (void)asprintf(&find_excludes, " "); 1392 1392 while((token = mr_strtok (sth, delims, &lastpos))) { 1393 asprintf(&strtmp,"%s", find_excludes);1393 (void)asprintf(&strtmp,"%s", find_excludes); 1394 1394 paranoid_free(find_excludes); 1395 asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);1395 (void)asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token); 1396 1396 paranoid_free(strtmp); 1397 1397 paranoid_free(token); … … 1399 1399 #if linux 1400 1400 // 2.6 has /sys as a proc-type thing -- must be excluded 1401 asprintf(&strtmp,1401 (void)asprintf(&strtmp, 1402 1402 "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", 1403 1403 dir, find_excludes, g_skeleton_filelist); 1404 1404 #else 1405 1405 // On BSD, for example, /sys is the kernel sources -- don't exclude 1406 asprintf(&strtmp,1406 (void)asprintf(&strtmp, 1407 1407 "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", 1408 1408 dir, find_excludes, g_skeleton_filelist); … … 1410 1410 paranoid_free(find_excludes); 1411 1411 log_msg(5, "find command = %s", strtmp); 1412 system(strtmp);1412 (void)system(strtmp); 1413 1413 paranoid_free(strtmp); 1414 asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);1414 (void)asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist); 1415 1415 g_skeleton_entries = 1416 1416 1 + atol(call_program_and_get_last_line_of_output(tmp)); … … 1442 1442 #ifndef _XWIN 1443 1443 if (!g_text_mode) { 1444 asprintf(&tmp, "Reading %-68s", dir);1444 (void)asprintf(&tmp, "Reading %-68s", dir); 1445 1445 newtDrawRootText(0, g_noof_rows - 3, tmp); 1446 1446 paranoid_free(tmp); … … 1456 1456 // log_msg(0, "Cataloguing %s", dir); 1457 1457 if (sth[0] == ' ') { 1458 asprintf(&skip_these, "%s", sth);1458 (void)asprintf(&skip_these, "%s", sth); 1459 1459 } else { 1460 asprintf(&skip_these, " %s ", sth);1461 } 1462 asprintf(&new_with_spaces, " %s ", dir);1460 (void)asprintf(&skip_these, " %s ", sth); 1461 } 1462 (void)asprintf(&new_with_spaces, " %s ", dir); 1463 1463 if ((dip = opendir(dir)) == NULL) { 1464 asprintf(&tmp,"opendir %s", dir);1464 (void)asprintf(&tmp,"opendir %s", dir); 1465 1465 log_OS_error(tmp); 1466 1466 paranoid_free(tmp); … … 1472 1472 i++; 1473 1473 if (strcmp(dir, "/")) { 1474 asprintf(&new,"%s/%s",dir,dit->d_name);1474 (void)asprintf(&new,"%s/%s",dir,dit->d_name); 1475 1475 } else { 1476 asprintf(&new,"%s%s",dir,dit->d_name);1476 (void)asprintf(&new,"%s%s",dir,dit->d_name); 1477 1477 } 1478 1478 paranoid_free(new_with_spaces); 1479 asprintf(&new_with_spaces, " %s ", new);1479 (void)asprintf(&new_with_spaces, " %s ", new); 1480 1480 if (strstr(skip_these, new_with_spaces)) { 1481 1481 fprintf(fout, "%s\n", new); … … 1496 1496 counter = 0; 1497 1497 uberctr++; 1498 asprintf(&tmp, " %c ",1498 (void)asprintf(&tmp, " %c ", 1499 1499 special_dot_char(uberctr)); 1500 1500 #ifndef _XWIN … … 1550 1550 bool in_quotes = FALSE; 1551 1551 1552 asprintf(&sz_res, "%s", incoming);1552 (void)asprintf(&sz_res, "%s", incoming); 1553 1553 p = sz_res; 1554 1554 while ((*p != ' ' || in_quotes) && *p != '\0') { … … 1598 1598 fatal_error("Cannot malloc exclude_paths"); 1599 1599 } 1600 asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);1600 (void)asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1601 1601 if (!include_paths && !userdef_filelist) { 1602 1602 fatal_error … … 1606 1606 sprintf(command, "mkdir -p %s/archives", scratchdir); 1607 1607 paranoid_system(command); 1608 asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);1608 (void)asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir); 1609 1609 make_hole_for_file(sz_filelist); 1610 1610 … … 1646 1646 log_msg(2, "include_paths = '%s'", include_paths); 1647 1647 log_msg(1, "Calculating filelist"); 1648 asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));1648 (void)asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'")); 1649 1649 if (strlen(tmp2) < 1) { 1650 asprintf(&tmp1," ");1650 (void)asprintf(&tmp1," "); 1651 1651 } else { 1652 1652 log_msg(2, "Found windows FS: %s",tmp2); 1653 asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);1653 (void)asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1654 1654 paranoid_free(tmp2); 1655 asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));1655 (void)asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1656 1656 log_msg(2, "Found windows files: %s",tmp2); 1657 1657 } … … 1813 1813 // fscanf(fin, "%s\n", fname); 1814 1814 len = MAX_STR_LEN - 1; 1815 getline(&fname, &len, fin); // patch by Scrub1815 (void)getline(&fname, &len, fin); // patch by Scrub 1816 1816 if (!use_star) { 1817 1817 if (fname[0] == '/') { … … 1883 1883 return (1); 1884 1884 } 1885 for ( fgets(tmp, MAX_STR_LEN, fin); !feof(fin);1886 fgets(tmp, MAX_STR_LEN, fin)) {1885 for ((void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin); 1886 (void)fgets(tmp, MAX_STR_LEN, fin)) { 1887 1887 if (!tmp[0]) { 1888 1888 continue;
Note:
See TracChangeset
for help on using the changeset viewer.