#ifdef _SC_OPEN_MAX
-  if (nfd > sysconf (_SC_OPEN_MAX))
+  static int sc_open_max = -1;
+
+  if (nfd < 0
+      || (nfd > sc_open_max
+          && (sc_open_max != -1
+             || nfd > (sc_open_max = sysconf (_SC_OPEN_MAX)))))

Doesn't this make poll non-reentrant?
Are there systems where assigning to an int is not atomic?

I don't think so, and gnulib's gt_TYPE_SIG_ATOMIC_T defines sig_atomic_t as int if there is none provided by the system. I can make sc_open_max a sig_atomic_t if we care about it.

Paolo


Reply via email to