-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.71 2004-08-18 09:58:28 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.72 2004-08-18 10:24:38 hadaq Exp $";
#define _POSIX_C_SOURCE 199309L
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/vfs.h>
#include <time.h>
#include <syslog.h>
my->queueSize = 1 * 1024 * 1024;
strcpy(my->verbosity, "info");
my->evtId = 0;
- my->maxFileSz = (2 * 1024 * 1024 * 1024UL);
+ my->maxFileSz = (2 * 1024 * 1024 * 1024UL - 1);
}
static int argsFromCL(TheArgs *my, int argc, char *argv[])
syslog(LOG_ERR, "opening file %s: %s", theArgs->outPath, strerror(errno));
outFile = NULL;
return -1;
+ } else {
+ struct statfs bufS, *buf = &bufS;
+ statfs(theArgs->outPath, buf);
+ if (theArgs->maxFileSz / buf->f_bsize > buf->f_bavail) {
+ errno = ENOSPC;
+ fclose(outFile);
+ outFile = NULL;
+ unlink(theArgs->outPath);
+ syslog(LOG_ERR, "opening file %s: %s", theArgs->outPath, strerror(errno));
+ return -1;
+ }
}
} else if (strcmp(theArgs->outDev, "tape") == 0) {
if (strcmp(theArgs->outPath, "") == 0) {