attach only to regular files
authorMichal Voců <michal@ruk.cuni.cz>
Mon, 17 Dec 2012 11:19:36 +0000 (11:19 +0000)
committerMichal Voců <michal@ruk.cuni.cz>
Mon, 17 Dec 2012 11:19:36 +0000 (11:19 +0000)
org.glite.lb.logger/src/event_store.c

index 7fa1982..13d1ac1 100644 (file)
@@ -1268,6 +1268,7 @@ event_store_from_file(char *filename)
        struct event_store *es;
        FILE *event_file;
        char *event_s, *job_id_s = NULL;
+       struct stat st_buf;
        int ret;
 #if defined(IL_NOTIFICATIONS)
        edg_wll_Event *notif_event;
@@ -1282,6 +1283,19 @@ event_store_from_file(char *filename)
                return(0);
        }
 
+       
+       if(stat(filename, &st_buf) < 0) {
+               glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO,
+                                "  could not stat file, skipping");
+               return 0;
+       }
+
+       if(!S_ISREG(st_buf.st_mode)) {
+               glite_common_log(IL_LOG_CATEGORY, LOG_PRIORITY_INFO,
+                                "  this is not a regular file, skipping");
+               return 0;
+       }
+
        event_file = fopen(filename, "r");
        if(event_file == NULL) {
                set_error(IL_SYS, errno, "event_store_from_file: error opening event file");