Ticket #197: SEND_THIS_IN_diff.newt-specific.c.fix_for_counting_deleted_files

File SEND_THIS_IN_diff.newt-specific.c.fix_for_counting_deleted_files, 1.4 KB (added by Scott Cummings, 17 years ago)

patch

Line 
1--- newt-specific.c.orig 2007-09-02 22:06:16.000000000 -0500
2+++ newt-specific.c 2007-09-08 21:25:23.000000000 -0500
3@@ -1484,9 +1484,10 @@
4 int load_filelist_into_array(struct s_filelist *filelist,
5 char *source_file) {
6 int i;
7+ int j;
8 bool done;
9 char *tmp;
10- FILE *fin;
11+ FILE *fin, *fout;
12 struct s_filelist_entry dummy_fle;
13
14 malloc_string(tmp);
15@@ -1501,7 +1502,15 @@
16 paranoid_free(tmp);
17 return (1);
18 }
19+
20+ if (!(fout = fopen("/tmp/icantfindthesefiles.txt", "a"))) {
21+ fatal_error("Cannot open icantfindthesefiles.txt");
22+ }
23+
24+
25+
26 log_msg(2, "Loading %s", source_file);
27+ j = 0;
28 for (filelist->entries = 0; filelist->entries <= ARBITRARY_MAXIMUM;
29 filelist->entries++) {
30 god_i_hate_gotos:
31@@ -1519,7 +1528,10 @@
32 if (i < 2) {
33 goto god_i_hate_gotos;
34 }
35- if (!does_file_exist(tmp)) {
36+ if (!does_file_exist(tmp) && !feof(fin)) {
37+ j++;
38+ fprintf(fout, "%s\n", tmp);
39+
40 goto god_i_hate_gotos;
41 }
42 filelist->el[filelist->entries].severity =
43@@ -1530,6 +1542,8 @@
44 }
45 }
46 paranoid_fclose(fin);
47+ paranoid_fclose(fout);
48+ log_to_screen("%d files listed in /tmp/changed.files have been deleted since backup was made", j);
49 if (filelist->entries >= ARBITRARY_MAXIMUM) {
50 log_to_screen("Arbitrary limits suck, man!");
51 paranoid_free(tmp);