chiark / gitweb /
regress: Do not provide our own malloc in fuzz mode
[adns.git] / regress / hplayback.c.m4
index ad27a9aee0bb8da04c4be0725e94dbc0ba352b3f..312a04a159b064b2fccf06265ef60ace94126639 100644 (file)
@@ -3,7 +3,7 @@ m4_dnl (part of complex test harness, not of the library)
 m4_dnl - playback routines
 
 m4_dnl  This file is part of adns, which is
-m4_dnl    Copyright (C) 1997-2000,2003,2006,2014-2016  Ian Jackson
+m4_dnl    Copyright (C) 1997-2000,2003,2006,2014-2016,2020  Ian Jackson
 m4_dnl    Copyright (C) 2014  Mark Wooding
 m4_dnl    Copyright (C) 1999-2000,2003,2006  Tony Finch
 m4_dnl    Copyright (C) 1991 Massachusetts Institute of Technology
@@ -69,16 +69,14 @@ static void Pcheckinput(void) {
 }
 
 void Tensurerecordfile(void) {
-  const char *fdstr;
   int fd;
   int chars;
   unsigned long sec, usec;
 
   if (Tinputfile) return;
   Tinputfile= stdin;
-  fdstr= getenv("ADNS_TEST_IN_FD");
-  if (fdstr) {
-    fd= atoi(fdstr);
+  fd = Ttestinputfd();
+  if (fd >= 0) {
     Tinputfile= fdopen(fd,"r"); if (!Tinputfile) Tfailed("fdopen ADNS_TEST_IN_FD");
   }
   setvbuf(Tinputfile,0,_IONBF,0);
@@ -126,6 +124,7 @@ static int Perrno(const char *stuff) {
   if (te->n) return te->v;
   r= strtoul(stuff+2,&ep,10);
   if (*ep) Psyntax("errno value not recognised, not numeric");
+  if (r==0 || r>255) Psyntax("numeric errno out of range 1..255");
   return r;
 }