Lines 1-151
Link Here
|
1 |
diff -urN ChangeLog free-sa-2.0.0b4p7/ChangeLog |
|
|
2 |
--- ChangeLog 2011-05-02 19:28:57.000000000 +0400 |
3 |
+++ free-sa-2.0.0b4p7/ChangeLog 2011-05-07 23:10:07.024000097 +0400 |
4 |
@@ -1,4 +1,4 @@ |
5 |
-2.0.0b4p6: |
6 |
+2.0.0b4p7: |
7 |
* FR3024195 (w_config.c) |
8 |
You may use TAB for separating usertab entries. |
9 |
* (w_svg.*) |
10 |
@@ -15,6 +15,9 @@ |
11 |
* (w_config.*, r_topusers.c, free-sa.conf*) |
12 |
New options 'users_excess' and 'users_excess_limit' were added for |
13 |
generating plain text report file with users exceeding specified limit. |
14 |
+ * FR3137680 (w_log_operations.c) |
15 |
+ Clear cache directory in case if no records were found and exit with good |
16 |
+ return code. |
17 |
|
18 |
2.0.0b4: |
19 |
* (pt.iso88591.in, lt.iso885913.in) |
20 |
diff -urN global.mk free-sa-2.0.0b4p7/global.mk |
21 |
--- global.mk 2011-05-02 19:29:17.000000000 +0400 |
22 |
+++ free-sa-2.0.0b4p7/global.mk 2011-05-07 23:07:59.715999989 +0400 |
23 |
@@ -25,7 +25,7 @@ |
24 |
include $(GMKPATH)/configs/$(OSTYPE).mk |
25 |
|
26 |
PROGNAME = Free-SA |
27 |
-PROGVERSION = 2.0.0b4p6 |
28 |
+PROGVERSION = 2.0.0b4p7 |
29 |
PROGURL = http://free-sa.sourceforge.net |
30 |
PROGLNAME = free-sa |
31 |
PROGCOPYRIGHT = Copyright (C) 1997, 2006-2011 Oleg Sapon <xsov@mail.ru> |
32 |
diff -urN src/free-sa.c free-sa-2.0.0b4p7/src/free-sa.c |
33 |
--- src/free-sa.c 2010-11-01 01:18:34.000000000 +0300 |
34 |
+++ free-sa-2.0.0b4p7/src/free-sa.c 2011-05-07 21:11:47.995999949 +0400 |
35 |
@@ -42,6 +42,7 @@ |
36 |
SAdebug("Open file count: %d\nUsers entries count: %d\n", ofcount, icfg.ueCount); |
37 |
#endif |
38 |
|
39 |
+ |
40 |
EDEBUG(); |
41 |
return(EXIT_SUCCESS); |
42 |
} |
43 |
diff -urN src/work/w_log_operations.c free-sa-2.0.0b4p7/src/work/w_log_operations.c |
44 |
--- src/work/w_log_operations.c 2010-10-17 20:09:09.000000000 +0400 |
45 |
+++ free-sa-2.0.0b4p7/src/work/w_log_operations.c 2011-05-07 23:01:50.483000189 +0400 |
46 |
@@ -124,7 +124,7 @@ |
47 |
ures = (struct SAusertab *)bsearch(&ukey, icfg.Usertab, (size_t)icfg.utCount, sizeof(struct SAusertab), (int (*)(const void *, const void *))compSAusertab); |
48 |
if (ures != NULL) cures->vname = ures->ename; |
49 |
} |
50 |
- |
51 |
+ |
52 |
/* If we still not filled vname then fill it with value of name */ |
53 |
if (!cures->vname) cures->vname = cures->name; |
54 |
|
55 |
@@ -264,7 +264,11 @@ |
56 |
#endif |
57 |
|
58 |
/* Exit if no records found */ |
59 |
- if (!icfg.ueCount) SAexit("No records found"); |
60 |
+ if (!icfg.ueCount) { |
61 |
+ SArm(cfg.cache_directory); |
62 |
+ SAwarning("No records found"); |
63 |
+ exit(EXIT_SUCCESS); |
64 |
+ } |
65 |
|
66 |
/* Close log file */ |
67 |
SAfclose(Log); |
68 |
@@ -294,7 +298,7 @@ |
69 |
|
70 |
/* Save EOF position as end of 1st range (because ShowLogI seeks to EOF) */ |
71 |
eseek = SAftell(Log); |
72 |
- |
73 |
+ |
74 |
/* Fast (?) binary search */ |
75 |
for (;;) { |
76 |
/* Break if range is little enough to process it sequentally |
77 |
@@ -333,7 +337,7 @@ |
78 |
SAdebug("Final position found: %lld", (long long int)rseek); |
79 |
#endif |
80 |
} else SAwarning("Non-linear and/or non-seekable log format detected, can't seek for fast data processing"); |
81 |
- |
82 |
+ |
83 |
return 0; |
84 |
} |
85 |
|
86 |
@@ -341,11 +345,11 @@ |
87 |
/* Function initial/finish log position: start/end */ |
88 |
void ShowLogI(FILE *Log, time_t *mindate, time_t *maxdate) { |
89 |
time_t ttime; |
90 |
- |
91 |
- |
92 |
+ |
93 |
+ |
94 |
*mindate = SAMAXTIMET; |
95 |
*maxdate = 0L; |
96 |
- |
97 |
+ |
98 |
if (LogFormats[cfg.log_format].mode == 3) { /* Log file is linear and seekable */ |
99 |
/* Read first record date */ |
100 |
if (!READ_DT(Log, &ttime)) SAexit("Can't read log"); |
101 |
@@ -390,10 +394,10 @@ |
102 |
FILE *tLog; |
103 |
char *tbuf, tfname[FILENAMESIZE]; |
104 |
|
105 |
- |
106 |
+ |
107 |
SAsnprintf(tfname, sizeof(tfname), "%s.new", cfg.log_file); |
108 |
tLog = SAfopenI("w", tfname); |
109 |
- |
110 |
+ |
111 |
tbuf = (char *)SAmalloc(RECORDSIZE); |
112 |
while (READ_FULLDT(Log, &ttime, tbuf)) { |
113 |
/* Skip records in specified date range */ |
114 |
@@ -403,7 +407,7 @@ |
115 |
SAfwrite1("\n", 1L, tLog); |
116 |
} |
117 |
free(tbuf); |
118 |
- |
119 |
+ |
120 |
SAfclose(tLog); |
121 |
SAfcloseU(Log, cfg.log_file); |
122 |
if (rename(tfname, cfg.log_file)) SAexit("Can't rename %s to %s. %s", tfname, cfg.log_file, strerror(errno)); |
123 |
@@ -414,23 +418,23 @@ |
124 |
FILE *InitLog(void) { |
125 |
FILE *retval; |
126 |
struct stat tstat; |
127 |
- |
128 |
- |
129 |
+ |
130 |
+ |
131 |
retval = SAfopenI("r", cfg.log_file); |
132 |
if (fstat(fileno(retval), &tstat) == -1) SAexit("Can't stat %s", cfg.log_file); |
133 |
if (S_ISFIFO(tstat.st_mode)) { |
134 |
SAwarning("Log file is FIFO pipe, switching to non-seekable mode"); |
135 |
SAclrbit(LogFormats[cfg.log_format].mode, 0); |
136 |
} |
137 |
- |
138 |
+ |
139 |
/* Set READ_RECORD for manually specified log format (others - for all) */ |
140 |
READ_RECORDM = LogFormats[cfg.log_format].ReadRecordM; |
141 |
READ_RECORDI = LogFormats[cfg.log_format].ReadRecord; |
142 |
READ_DTI = LogFormats[cfg.log_format].ReadDT; |
143 |
READ_FULLDTI = LogFormats[cfg.log_format].ReadFullDT; |
144 |
READ_ALIGN = LogFormats[cfg.log_format].ReadAlign; |
145 |
- |
146 |
- |
147 |
+ |
148 |
+ |
149 |
return retval; |
150 |
} |
151 |
|