regress: Support NULL fdset arguments to select
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 28 Jan 2015 23:49:19 +0000 (23:49 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Jan 2015 00:24:24 +0000 (00:24 +0000)
We are going to want to pass these, and currently the test harness
will dereference the NULL.  So fix this.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
regress/hcommon.c
regress/hcommon.c.m4
regress/hplayback.c
regress/hplayback.c.m4

index e63a8cd..301fb2f 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;
index 330da4d..760ca0c 100644 (file)
@@ -160,6 +160,11 @@ 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;
index 279934c..ed23542 100644 (file)
@@ -102,6 +102,10 @@ static void P_updatetime(void) {
 static void Pfdset(fd_set *set, int max) {
   int r, c;
   char *ep;
+  if (!set) {
+    Pstring("null","null fdset pointer");
+    return;
+  }
   if (vb2.buf[vb2.used++] != '[') Psyntax("fd set start not [");
   FD_ZERO(set);
   if (vb2.buf[vb2.used] == ']') { vb2.used++; return; }
index 475144a..792952f 100644 (file)
@@ -150,6 +150,11 @@ static void P_updatetime(void) {
 static void Pfdset(fd_set *set, int max) {
   int r, c;
   char *ep;
+
+  if (!set) {
+    Pstring("null","null fdset pointer");
+    return;
+  }
   
   if (vb2.buf[vb2.used++] != hm_squote[hm_squote) Psyntax("fd set start not [");
   FD_ZERO(set);