[Openvpn-devel,v1] openvpnserv: report error if the pipe cannot be created on start
Commit Message
From: Heiko Hund <heiko@ist.eigentlich.net>
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 <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
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 <frank@lichtenheld.com>
@@ -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;
}