Joel Rosdahl <j...@rosdahl.net> writes: > Tom Lane <t...@sss.pgh.pa.us> wrote: >> Actually, that's a bug not just a cosmetic problem, because it introduces >> a race condition.
> Yes, sounds like a race condition that could happen. > I just pushed this change as a fix: > https://git.samba.org/?p=ccache.git;a=commitdiff;h=4fdb9580fedac9669508bef0837f46f1e9310e24. > Opinions on it are welcome. Hm. In principle there are still race conditions here: consider what happens if the SIGINT is received between fork() and storing the PID into *pid, or after waitpid() and before clearing *pid. Those windows are probably narrow enough to not be an issue in practice, but it's a bit nervous-making. One thing that might be worth doing is declaring pid (and hence the pointer argument) to be volatile so that the compiler wouldn't be tempted to rearrange the code and maybe make those windows bigger. That's required for formal C-spec-compliance anyway, given that pid is accessed by a signal handler. regards, tom lane _______________________________________________ ccache mailing list firstname.lastname@example.org https://lists.samba.org/mailman/listinfo/ccache