lib/tfork: Don't overwrite 'ret' in cleanup phase
commitcbe6fb38ec13adbe06667f16241d61d4e2a80545
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 10 Jan 2023 00:06:25 +0000 (10 13:06 +1300)
committerJeremy Allison <jra@samba.org>
Tue, 10 Jan 2023 20:22:32 +0000 (10 20:22 +0000)
treef97a79c94e3fe323db3b3cf8e36f3ae680933eef
parent01bd234f6af37641017a00da0dec729928ad3060
lib/tfork: Don't overwrite 'ret' in cleanup phase

The cleanup phase of tfork_create() saves errno prior to calling
functions that might modify it, with the intention of restoring it
afterwards. However, the value of 'ret' is accidentally overwritten. It
will always be equal to 0, and hence errno will not be restored.

Fix this by introducing a new variable, ret2, for calling functions in
the cleanup phase.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/tfork.c