]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliMDC.cxx
New start time: Fri, 20 Jun 2014 12:03:00 (GMT)
[u/mrichter/AliRoot.git] / RAW / AliMDC.cxx
index 2294e568fa281c05289d7fadcfdecb2943bd3ef5..869948a78e2b3b99950f64151dbf338de0d3c789 100644 (file)
@@ -248,7 +248,7 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
   Long64_t currentFileSize = GetTotalSize();
   //  AliDebug(1,Form("current file size is %lld bytes",currentFileSize));
   if(currentFileSize > kFileSizeErrorLevel) {
-    Error("ProcessEvent", "file size (%lu) exceeds the limit "
+    Error("ProcessEvent", "file size (%lld) exceeds the limit "
          , currentFileSize);
     return kErrFileSize;
   }
@@ -509,8 +509,10 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
   // Create new raw DB.
   if (fRawDB) Close();
 
-  if (Open(mode,NULL,maxFileSize,fs1,fs2) < 0) return 1;
-
+  if (Open(mode,NULL,maxFileSize,fs1,fs2) < 0) {
+    if (fd>-1) close(fd);
+    return 1;
+  }
   // Process input stream
 #ifdef USE_EB
   Int_t eorFlag = 0;
@@ -565,6 +567,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
            Error("Run", "error reading base header");
            Close();
            delete[] event;
+           if (fd>-1) close(fd);
            return 1;
          }
        }
@@ -593,6 +596,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
          Close();
          delete[] event;
          delete hdr;
+         if (fd>-1) close(fd);
          return 1;
        }
       }
@@ -612,6 +616,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
        Close();
        delete[] event;
        delete hdr;
+       if (fd>-1) close(fd);
        return 1;
       }
     }
@@ -642,6 +647,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
          Close();
          if (inputFile) delete[] event;
          delete hdr;
+         if (fd>-1) close(fd);
          return 1;
        }
 
@@ -694,7 +700,7 @@ Int_t AliMDC::Run(const char* inputFile, Bool_t loop,
 #endif
   } else {
     // Close input source
-    close(fd);
+    if (fd>-1) close(fd);
     delete [] event;
   }