configurator: Reimplement run using popen
authorKevin Locke <kevin@kevinlocke.name>
Thu, 29 Sep 2016 00:44:42 +0000 (18:44 -0600)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 30 Sep 2016 03:51:27 +0000 (13:51 +1000)
commit93992ee36410c42dd29bfb013c184ef9e9f360b3
tree4a5c4ca4649ba12dd1de550f2ac63bd58a654ee9
parent5dbd87b876434dd703dfcc30cb0503118aac2076
configurator: Reimplement run using popen

Rather than using fork+pipe+system+waitpid, most of which are only
available on POSIX-like systems, use popen which is also available on
Windows (under the name _popen).

Changes since v1:
- Create fread_noeintr to avoid EINTR in fread without reading any data.
- Handle short reads from fread.  This can happen with non-conformant
  libc or if EINTR occurs after reading some data.
- Define _POSIX_C_SOURCE for popen/pclose with strict implementations
  which require it (e.g. gcc with -std=c11).

Changes since v2:
- Revert fread_noeintr and short read changes in v1 as unnecessary.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
tools/configurator/configurator.c