|
@@ -144,6 +144,25 @@ given\n");
|
144
|
144
|
|
145
|
145
|
int ttail_init_check(ttail_t* t)
|
146
|
146
|
{
|
|
147
|
+ size_t i, ret;
|
|
148
|
+ if(t->logfile_sz)
|
|
149
|
+ {
|
|
150
|
+ ret = 0;
|
|
151
|
+ for(i=0; i<t->logfile_sz; i++)
|
|
152
|
+ {
|
|
153
|
+ if(t->logfile[i])
|
|
154
|
+ {
|
|
155
|
+ ret = 1;
|
|
156
|
+ break;
|
|
157
|
+ }
|
|
158
|
+ }
|
|
159
|
+ if(!ret)
|
|
160
|
+ {
|
|
161
|
+ fprintf(stderr, "Unable to read from any of the files \
|
|
162
|
+given as argument\n");
|
|
163
|
+ return -1;
|
|
164
|
+ }
|
|
165
|
+ }
|
147
|
166
|
if(t->flag & TTAIL_FLAG_DATE_MAX)
|
148
|
167
|
{
|
149
|
168
|
fprintf(stderr, "Warning : date-max not yet implemented\n");
|
|
@@ -198,6 +217,7 @@ int ttail_add_logfile(ttail_t* res, const char* filename)
|
198
|
217
|
if(!fp)
|
199
|
218
|
{
|
200
|
219
|
fprintf(stderr, "Unable to open file : %s\n", filename);
|
|
220
|
+ res->logfile[res->logfile_sz-1] = NULL;
|
201
|
221
|
ret = 1;
|
202
|
222
|
}
|
203
|
223
|
res->logfile[res->logfile_sz-1] = fp;
|