Skip to content
Snippets Groups Projects
Commit 818785b8 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel: Committed by Sergey Kosukhin
Browse files

Replace variable length array member with pointer.

parent 20dbff92
No related branches found
No related tags found
2 merge requests!34Version 2.2.0,!13Consolidation with CDI-PIO (develop)
......@@ -29,6 +29,7 @@
struct fileFunnelAIO
{
char *name;
struct dBuffer *fb;
struct aiocb *ctrlBlks;
off_t offset;
......@@ -36,7 +37,6 @@ struct fileFunnelAIO
unsigned numQueuedWrites;
int activeCollectors;
int handle, fileID;
char name[];
};
static int
......@@ -56,8 +56,12 @@ initBFiledataPA(char *filename, struct cdiPioConf *conf, int nc)
size_t aioQueueDepth = conf->aioQueueDepth;
xdebug("filename=%s, buffersize=%zu, ncollectors=%d, AIO queue depth=%zu", filename, bufSize, nc, aioQueueDepth);
bfd = (struct fileFunnelAIO *) Malloc(sizeof(*bfd) + strlen(filename) + 1);
strcpy(bfd->name, filename);
bfd = (struct fileFunnelAIO *) Malloc(sizeof(*bfd));
{
size_t filenameSize = strlen(filename) + 1;
char *name = bfd->name = Malloc(filenameSize);
strcpy(name, filename);
}
if ((bfd->handle = open(bfd->name, O_CREAT | O_WRONLY, 0666)) == -1) xabort("Failed to open %s", bfd->name);
......@@ -126,7 +130,8 @@ destroyBFiledataPA(void *v)
/* file closed, cleanup */
dbuffer_cleanup(&(bfd->fb));
Free(bfd->name);
bfd->name = NULL;
Free(bfd->ctrlBlks);
Free(bfd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment