chiark / gitweb /
regression tests: Properly handle adnshost et al exit status
[adns.git] / regress / hcommon.c
index e63a8cda57a0b30d40aefdc87c7bb5f46ef64e06..0aa3ffb05e58550310f050f708ed06ebc1b95602 100644 (file)
@@ -167,6 +167,10 @@ void Tvbbytes(const void *buf, int len) {
 void Tvbfdset(int max, const fd_set *fds) {
   int i;
   const char *comma= "";
+  if (!fds) {
+    Tvba("null");
+    return;
+  }
   Tvba("[");
   for (i=0; i<max; i++) {
     if (!FD_ISSET(i,fds)) continue;
@@ -285,7 +289,7 @@ void *Hrealloc(void *op, size_t nsz) {
   Hfree(op);
   return np;
 }
-void Hexit(int rv) {
+void Texit(int rv) {
   struct malloced *loopnode;
   Tshutdown();
   adns__vbuf_free(&vb);
@@ -299,6 +303,12 @@ void Hexit(int rv) {
   }
   exit(rv);
 }
+void Hexit(int rv) {
+  vb.used= 0;
+  Tvbf("exit %d", rv);
+  Q_vb();
+  Texit(0);
+}
 pid_t Hgetpid(void) {
   return 2264; /* just some number */
 }