Re: [dev] [sdhcp] [PATCH 1/2] Only fork once

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Mon, 27 Apr 2015 10:35:01 +0200

Michael Forney wrote:
> + if(!forked) {
> + if(fork())
> + exit(EXIT_SUCCESS);
> + forked = 1;
> + }

Heyho,

why not:

        if(!forked && fork())
                exit(EXIT_SUCCESS);
        forked = 1;


You could also use

        if(!forked && (forked = fork()))
                exit(EXIT_SUCCESS);

but that is a little bit confusing.

--Markus
Received on Mon Apr 27 2015 - 10:35:01 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 27 2015 - 10:36:25 CEST