]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Changed bytesWritten to unsigned long, inserted fileno()-call. evtbuild.c should...
authorhades <hades>
Fri, 19 May 2000 08:30:56 +0000 (08:30 +0000)
committerhades <hades>
Fri, 19 May 2000 08:30:56 +0000 (08:30 +0000)
hadaq/evtbuild.c
hadaq/tape.c
hadaq/tape.h
hadaq/tapelabel.c
hadaq/tapelabel.h

index c5d128ce9dcbeb836f44ff0fd72f30bb0cb8a663..736a893cbd59e0bfdb384923b9470cc7e6ff1d73 100644 (file)
@@ -1,4 +1,4 @@
-static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.11 2000-04-18 11:44:06 muench Stab $";
+static char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.12 2000-05-19 08:30:56 hades Exp $";
 
 #define _XOPEN_SOURCE
 #include <unistd.h>
@@ -368,7 +368,12 @@ int main(int argc, char *argv[])
        free(slowCtrlFiles);
 
        if (outFile != NULL) {
-               if (-1 == fclose(outFile)) {
+               if (strcmp(outDev, "tape") == 0) {
+                       if (-1 == closeTape(outFile, *bytesWritten, outPath)) {
+                               msglog(LOG_ERR, "%s, %d: %s\n", __FILE__, __LINE__, strerror(errno));
+                               exit(EXIT_FAILURE);
+                       }
+               } else if (-1 == fclose(outFile) {
                        msglog(LOG_NOTICE, "%s, line %d:\n", __FILE__, __LINE__, strerror(errno));
                }
        }
index db9a686e2bb3bd011bd591a4ae5c164d38398608..b0a22c35f6ca6e328dc700b5fd0944531a1c5095 100644 (file)
@@ -97,8 +97,14 @@ static FILE *openTape(const char* filename) {
        setvbuf(outFile, 0, _IOFBF, BLOCKSIZE);
 }
 
-int closeTape(FILE *openTape, int tape, int numBytes, const char *filename) {
+int closeTape(FILE *openTape, unsigned long numBytes, const char *filename) {
        int stat;
+       int tape;
+       tape = fileno(openTape);
+       if (tape == -1) {
+               msglog(LOG_ERR, "Could not get file file descriptor of file opened on tape!\n");
+               exit(-2);
+       }
        stat = fclose(openTape);
        if (stat == -1) {
                msglog(LOG_ERR, "Could not close file on tape!\n");
index 8cf0ae6ce60524188e5a364bb58355e562e9ab38..a5832c4ffc4c1f99d4aeeb56426e893645e57187 100644 (file)
@@ -3,7 +3,7 @@
 
 static FILE *openTape(const char *);
 
-int closeTape(FILE *, int, int, const char *);
+int closeTape(FILE *, unsigned long, const char *);
 
 #endif
 
index 6300cf58c1613e0558a7c983cbcd720b5bc63252..2445df94a22b31acae911813e2499ef28686d67c 100644 (file)
@@ -154,7 +154,7 @@ int writeHeader(int tape, int fileSeqNum, const char *filename) {
 }
 
 
-int writeTrailer(int tape, int fileSeqNum, int numBytes, const char *filename) {
+int writeTrailer(int tape, int fileSeqNum, unsigned long numBytes, const char *filename) {
        int stat;
        int i;
        int blockSize = BLOCKSIZE;
index 35184d82d2c498229e5873a08a4e1806c0dbe19d..9f36d78ba5cca98b8c52ad7928486cee33745148 100644 (file)
@@ -3,12 +3,12 @@
 
 #define BLOCKSIZE 8192
 
-int writeHeader(int, int, const char *);
-int writeTrailer(int, int, int, const char *);
-
 char *readVolumeLabel(int);
 int writeVolumeLabel(const char *, int);
 int writeNewVolumeLabel(const char *, const char *, int);
 
+int writeHeader(int, int, const char *);
+int writeTrailer(int, int, unsigned long, const char *);
+
 #endif