git: dsynth - Fix master/slave pty race on fork()

Matthew Dillon dillon at
Sun Aug 25 12:27:15 PDT 2019

commit 168bca188b0a50fca2f82a65255dd569abd42abf
Author: Matthew Dillon <dillon at>
Date:   Sun Aug 25 12:23:37 2019 -0700

    dsynth - Fix master/slave pty race on fork()
    * If we try to re-open the slave in the forked child of the WORKER monitor,
      the worker monitor may race the child when it tries to read from the
      master side fd before the child has opened the slave, causing an error.
    * If we re-open the slave in the WORKER monitor then the worker monitor
      must not block when it close()s the slave descriptor after forking a
      child.  But it will if the child has written anything.
      The solution is to re-open the slave in the master but to have the
      master write 1 char to the slave after close()ing the slavefd.  The
      forked slave will read this character before proceeding, thus ensuring
      that there is no output in the buffer when the master close()es
      its slavefd.

Summary of changes:
 usr.bin/dsynth/build.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

DragonFly BSD source repository

More information about the Commits mailing list