about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-12-01 10:50:19 +0000
committerEric Wong <normalperson@yhbt.net>2013-12-02 04:36:28 +0000
commit2410738dcf00cda49c9f1d5847289f6a48944c2a (patch)
tree75c843f1d9c0334486c473f4ae21a94c4207421d
parent1a4a94f338dbe641a3f1b27a080fc34bac7f43d4 (diff)
downloadcmogstored-2410738dcf00cda49c9f1d5847289f6a48944c2a.tar.gz
This test failed when during the test on FreeBSD 11.0-CURRENT with
MALLOC_DEBUG enabled or if MALLOC_OPTIONS=J is set in the environment.

Reported-by: Mikolaj Golub
-rw-r--r--test/chunk-parser-1.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/chunk-parser-1.c b/test/chunk-parser-1.c
index fd1de49..2e62a13 100644
--- a/test/chunk-parser-1.c
+++ b/test/chunk-parser-1.c
@@ -19,6 +19,20 @@ static void reset(void)
         mog_chunk_init(http);
 }
 
+/*
+ * we do this because we used tmpfile to generate a temporary file
+ * and did not use any existing API to open the file.
+ */
+static void test_mog_file_init(struct mog_file *file)
+{
+        struct mog_svc *svc = file->svc;
+        struct mog_ioq *ioq = file->ioq;
+
+        memset(file, 0, sizeof(struct mog_file));
+        file->svc = svc;
+        file->ioq = ioq;
+}
+
 static void buf_set(const char *s)
 {
         struct mog_file *file;
@@ -31,7 +45,7 @@ static void buf_set(const char *s)
         assert(tmpfd >= 0 && "invalid fd");
         http->forward = mog_fd_init(tmpfd, MOG_FD_TYPE_FILE);
         file = &http->forward->as.file;
-        file->foff = 0;
+        test_mog_file_init(file);
         buf = xstrdup(s);
         len = strlen(s);
 }