chiark / gitweb /
Fix typo in changelog entry for 1.6.1
[adns.git] / regress / hplayback.c.m4
index 4ab05c1e285178787b14e7f98e3afa77de908eff..7e688bf1eac04f7ca2c5937ab17b16d87f7933e8 100644 (file)
@@ -2,12 +2,8 @@ m4_dnl hplayback.c.m4
 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,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
-m4_dnl  (See the file INSTALL for full details.)
+m4_dnl  This file is part of adns, which is Copyright Ian Jackson
+m4_dnl  and contributors (see the file INSTALL for full details).
 m4_dnl  
 m4_dnl  This program is free software; you can redistribute it and/or modify
 m4_dnl  it under the terms of the GNU General Public License as published by
@@ -170,19 +166,25 @@ static int Perrno(const char *stuff) {
 
 static void P_updatetime(void) {
   int chars;
-  unsigned long sec, usec;
+  unsigned long sec;
+  long usec;
 
   if (!adns__vbuf_ensure(&vb2,1000)) Tnomem();
   fgets(vb2.buf,vb2.avail,Tinputfile); Pcheckinput();
   chars= -1;
-  sscanf(vb2.buf," +%lu.%lu%n",&sec,&usec,&chars);
+  sscanf(vb2.buf," +%lu.%ld%n",&sec,&usec,&chars);
   if (chars==-1) Psyntax("update time invalid");
   currenttime.tv_sec+= sec;
-  currenttime.tv_usec+= usec;
-  if (currenttime.tv_usec > 1000000) {
+  usec = (long)currenttime.tv_usec + usec;
+  while (usec < 0) {
+    currenttime.tv_sec--;
+    usec += 1000000;
+  }
+  while (usec > 1000000) {
     currenttime.tv_sec++;
-    currenttime.tv_usec -= 1000000;
+    usec -= 1000000;
   }
+  currenttime.tv_usec = usec;
   if (vb2.buf[chars] != hm_squote\nhm_squote) Psyntax("not newline after update time");
 }
 
@@ -265,6 +267,7 @@ static void Ppollfds(struct pollfd *fds, int nfds) {
     if (gotevents != fds->events) Psyntax("poll fds[].events changed");
     Pstring(", revents=",", revents= in pollfds");
     fds->revents= Ppollfdevents();
+    if (gotevents) FR_WRITE(fds->revents);
     Pstring("}","} in pollfds");
     Pstring(comma,"separator in pollfds");
     comma= ", ";