chiark / gitweb /
regress: Do not provide our own malloc in fuzz mode
[adns.git] / regress / hplayback.c.m4
index b3c45c6c7eed1548c12a6d8df9bff9e3324ae3a0..312a04a159b064b2fccf06265ef60ace94126639 100644 (file)
@@ -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;
 }