chiark / gitweb /
regress: fuzzraw: Call Tensuresetup in Q_vb, just in case
[adns.git] / regress / hfuzzraw.c.m4
index bc3676671a311f63da8ab3b0fae4227febcf2e7f..7cc1d30d0f9878413e437c134a34bcf86e0305ba 100644 (file)
@@ -53,29 +53,7 @@ static void Tflushstdout( void) {
   if (fflush(stdout)) Toutputerr();
 }
 
-void Q_vb(void) {
-  if (!adns__vbuf_append(&vb,"",1)) Tnomem();
-  if (fprintf(stdout," %s\n",vb.buf) == EOF) Toutputerr();
-  Tflushstdout();
-}
-
-static void Pformat(const char *what) {
-  fprintf(stderr,"adns test harness: format error in raw log input file: %s\n",what);
-  exit(-1);
-}
-
-extern void Tshutdown(void) {
-  int c= fgetc(Tinputfile);
-  if (c!=EOF) Pformat("unwanted additional syscall reply data");
-  if (ferror(Tinputfile)) Tfailed("read test log input (at end)");
-}
-
-static void Pcheckinput(void) {
-  if (ferror(Tinputfile)) Tfailed("read test log input file");
-  if (feof(Tinputfile)) Pformat("eof at syscall reply");
-}
-
-void Tensurerecordfile(void) {
+void Tensuresetup(void) {
   static int done;
 
   if (done) return;
@@ -97,6 +75,28 @@ void Tensurerecordfile(void) {
   if (proutstr) stdout_enable= atoi(proutstr);
 }
 
+void Q_vb(void) {
+  Tensuresetup();
+  if (!adns__vbuf_append(&vb,"",1)) Tnomem();
+  if (fprintf(stdout," %s\n",vb.buf) == EOF) Toutputerr();
+  Tflushstdout();
+}
+
+static void Pformat(const char *what) {
+  fprintf(stderr,"adns test harness: format error in raw log input file: %s\n",what);
+  exit(-1);
+}
+
+extern void Tshutdown(void) {
+  int c= fgetc(Tinputfile);
+  if (c!=EOF) Pformat("unwanted additional syscall reply data");
+  if (ferror(Tinputfile)) Tfailed("read test log input (at end)");
+}
+
+static void Pcheckinput(void) {
+  if (ferror(Tinputfile)) Tfailed("read test log input file");
+  if (feof(Tinputfile)) Pformat("eof at syscall reply");
+}
 
 static void P_read_dump(const unsigned char *p0, size_t count, ssize_t d) {
   fputs(" | ",stdout);
@@ -220,10 +220,7 @@ static void Ppollfds(struct pollfd *fds, int nfds, int *r_io) {
 static int P_succfail(void) {
   int e;
   P_READ(e);
-  if (e<0 && -e<Tnerrnos) {
-    errno= Terrnos[-e].v;
-    return -1;
-  } else if (e>0 && e<=255) {
+  if (e>0) {
     errno= e;
     return -1;
   } else if (e) {
@@ -245,7 +242,7 @@ int H$1(hm_args_massage($3,void)) {
  hm_create_hqcall_init($1)
  $3
 
- Tensurerecordfile();
+ Tensuresetup();
 
  if (stdout_enable) {
    hm_create_hqcall_args