Change initialize a bit
[c11tester.git] / pipe.cc
diff --git a/pipe.cc b/pipe.cc
index 37bb0dc6620079e6b7b612e673c36e02debb62ae..1f451dcbe41ee85473494bad7896206594a57afc 100644 (file)
--- a/pipe.cc
+++ b/pipe.cc
@@ -1,22 +1,21 @@
 #include "common.h"
 #include <unistd.h>
 #include "model.h"
 #include "common.h"
 #include <unistd.h>
 #include "model.h"
+#include "snapshot-interface.h"
 #include <dlfcn.h>
 #include <dlfcn.h>
+#include <errno.h>
 
 static int (*pipe_init_p)(int filep[2]) = NULL;
 
 int pipe(int fildes[2]) {
 
 static int (*pipe_init_p)(int filep[2]) = NULL;
 
 int pipe(int fildes[2]) {
-  if (!model) {
-    snapshot_system_init(10000, 1024, 1024, 40000);
-    model = new ModelChecker();
-    model->startChecker();
-  }
-  if (!pipe_init_p) {
-    pipe_init_p = (int (*)(int file[2])) dlsym(RTLD_NEXT, "pipe");
-    if ((error = dlerror()) != NULL) {
-      fputs(error, stderr);
-      exit(EXIT_FAILURE);
-    }
-  }
-  pipe_init_p(filedes);
+       createModelIfNotExist();
+       if (!pipe_init_p) {
+               pipe_init_p = (int (*)(int fildes[2]))dlsym(RTLD_NEXT, "pipe");
+               char *error = dlerror();
+               if (error != NULL) {
+                       fputs(error, stderr);
+                       exit(EXIT_FAILURE);
+               }
+       }
+       return pipe_init_p(fildes);
 }
 }