@@ -183,7 +183,6 @@ static inline int do_glob(const char *pattern, int flags,
183183 return ret ;
184184}
185185
186-
187186/* Scan a path, register the entries and return how many */
188187static int tail_scan_path (const char * path , struct flb_tail_config * ctx )
189188{
@@ -212,16 +211,23 @@ static int tail_scan_path(const char *path, struct flb_tail_config *ctx)
212211 flb_plg_error (ctx -> ins , "no memory space available" );
213212 return -1 ;
214213 case GLOB_ABORTED :
215- if (!ctx -> ignore_missing_paths ) {
216- flb_plg_error (ctx -> ins , "read error, check permissions: %s" , path );
214+ if (errno == EACCES ) {
215+ flb_plg_error (ctx -> ins , "NO read access for path: %s" , path );
216+ } else if (!ctx -> ignore_unavailable ) {
217+ switch (errno ) {
218+ case ENOENT :
219+ flb_plg_warn (ctx -> ins , "No such file at path: %s" , path );
220+ case ENOTDIR :
221+ flb_plg_error (ctx -> ins , "Not directory at path: %s" , path );
222+ default :
223+ flb_plg_error (ctx -> ins , "Unable to read path: %s" , path );
224+ }
217225 }
218226 return -1 ;
219227 case GLOB_NOMATCH :
220228 ret = stat (path , & st );
221229 if (ret == -1 ) {
222- if (!ctx -> ignore_missing_paths ) {
223- flb_plg_debug (ctx -> ins , "cannot read info from: %s" , path );
224- }
230+ flb_plg_debug (ctx -> ins , "cannot read info from: %s" , path );
225231 }
226232 else {
227233 ret = access (path , R_OK );
0 commit comments