On Mon, Apr 13, 2015 at 09:20:34AM +0200, Roberto E. Vargas Caballero wrote: > I don't understand this patch. The switch-fork is a common idiom > and I don't know why you think it should be changed.
It separates the case when fork fails and when fork succeeds. You can even move error-processing code to something like xfork(). First, we die if fork failed. If fork succeeds, we continue and have branches for child (pid == 0) and parent (pid == child). With switch, we have branches for failed parent, child and suceeded parent, in this order. Also, the code is obviously shorter.