[Openvpn-devel] include unistd.h for _exit(2) declaration

Message ID 20220527113411.1846837-1-heiko@ist.eigentlich.net
State Not Applicable
Headers show
Series [Openvpn-devel] include unistd.h for _exit(2) declaration | expand

Commit Message

Heiko Hund May 27, 2022, 1:34 a.m. UTC
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
---
 src/openvpn/error.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Gert Doering May 27, 2022, 1:40 a.m. UTC | #1
Hi,

On Fri, May 27, 2022 at 01:34:11PM +0200, Heiko Hund wrote:
> Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
> ---
>  src/openvpn/error.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/openvpn/error.h b/src/openvpn/error.h
> index 972619fe..76308560 100644
> --- a/src/openvpn/error.h
> +++ b/src/openvpn/error.h
> @@ -33,6 +33,8 @@
>  
>  #if _WIN32
>  #include <windows.h>
> +#else
> +#include <unistd.h>
>  #endif
>  
>  /* #define ABORT_ON_ERROR */

<unistd.h> is included by "syshead.h" already today, with a nice
HAVE_UNISTD_H wraper (thus, not depending on a "if it's not WIN32,
it surely must have unistd.h" assumption).

So I wonder what issue this fixes?  I see no compile time warnings about
_exit() either.

gert
Heiko Hund May 27, 2022, 1:51 a.m. UTC | #2
Hi Gert

On Freitag, 27. Mai 2022 13:40:57 CEST Gert Doering wrote:
> <unistd.h> is included by "syshead.h" already today, with a nice
> HAVE_UNISTD_H wraper (thus, not depending on a "if it's not WIN32,
> it surely must have unistd.h" assumption).
> 
> So I wonder what issue this fixes?  I see no compile time warnings about
> _exit() either.

I get "Implicit declaration of function '_exit' is invalid in C99 [-Wimplicit-
function-declaration]" complaints from my semantic analyzer, but it's because 
it didn't pick up the -DHAVE_CONFIG_H. So I think that can be ignored indeed.
Apologies for the noise.

Heiko

Patch

diff --git a/src/openvpn/error.h b/src/openvpn/error.h
index 972619fe..76308560 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -33,6 +33,8 @@ 
 
 #if _WIN32
 #include <windows.h>
+#else
+#include <unistd.h>
 #endif
 
 /* #define ABORT_ON_ERROR */