From: Heiko Hund <[email protected]> If the first pipe instance could not be created, the service stopped with exit code 0, e.g. when another process already owned the name.
Keep the error code of CreateClientPipeInstance() intact, logging it before LocalFree() may change it, and use it as the exit code. Change-Id: I056164a3016d62152dfcbd57f75d58534dda8fc8 Signed-off-by: Heiko Hund <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2113 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2113 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <[email protected]> diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 5e4b555..bffc9da 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -3832,7 +3832,9 @@ if (!ConvertStringSecurityDescriptorToSecurityDescriptor(sddlString, SDDL_REVISION_1, &sd, NULL)) { - MsgToEventLog(M_SYSERR, L"ConvertStringSecurityDescriptorToSecurityDescriptor failed."); + DWORD error = + MsgToEventLog(M_SYSERR, L"ConvertStringSecurityDescriptorToSecurityDescriptor failed."); + SetLastError(error); return INVALID_HANDLE_VALUE; } @@ -3871,14 +3873,15 @@ &sa); } - LocalFree(sd); - if (pipe == INVALID_HANDLE_VALUE) { - MsgToEventLog(M_SYSERR, L"Could not create named pipe"); + DWORD error = MsgToEventLog(M_SYSERR, L"Could not create named pipe"); + LocalFree(sd); + SetLastError(error); return INVALID_HANDLE_VALUE; } + LocalFree(sd); return pipe; } @@ -4043,6 +4046,7 @@ pipe = CreateClientPipeInstance(); if (pipe == INVALID_HANDLE_VALUE) { + error = GetLastError(); goto out; } _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
