testsuite: stdlib/isomac.c: add missing include

Message ID 20190108201038.20996-1-aurelien@aurel32.net
State Committed
Headers

Commit Message

Aurelien Jarno Jan. 8, 2019, 8:10 p.m. UTC
  When running the testsuite, building stdlib/isomac.c outputs the
following warning:

  gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
  isomac.c: In function ‘get_null_defines’:
  isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
     close (fd);
     ^~~~~
     pclose

Fix that by adding the <unistd.h> include.

Changelog:
	* stdlib/isomac.c: Include <unistd.h>.
---
 ChangeLog       | 4 ++++
 stdlib/isomac.c | 1 +
 2 files changed, 5 insertions(+)
  

Comments

Jonathan Nieder Jan. 8, 2019, 11:35 p.m. UTC | #1
Aurelien Jarno wrote:

> When running the testsuite, building stdlib/isomac.c outputs the
> following warning:
>
>   gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
>   isomac.c: In function ‘get_null_defines’:
>   isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
>      close (fd);
>      ^~~~~
>      pclose
>
> Fix that by adding the <unistd.h> include.
>
> Changelog:
> 	* stdlib/isomac.c: Include <unistd.h>.
> ---
>  ChangeLog       | 4 ++++
>  stdlib/isomac.c | 1 +
>  2 files changed, 5 insertions(+)

Indeed, in POSIX close() requires unistd.h[*].

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

[*] pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
  
Aurelien Jarno Feb. 2, 2019, 10:57 a.m. UTC | #2
On 2019-01-08 21:10, Aurelien Jarno wrote:
> When running the testsuite, building stdlib/isomac.c outputs the
> following warning:
> 
>   gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
>   isomac.c: In function ‘get_null_defines’:
>   isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
>      close (fd);
>      ^~~~~
>      pclose
> 
> Fix that by adding the <unistd.h> include.
> 

Ping, now that master is opened again for development, is this patch
fine to be committed?
  
Florian Weimer Feb. 2, 2019, 11:50 a.m. UTC | #3
* Aurelien Jarno:

> On 2019-01-08 21:10, Aurelien Jarno wrote:
>> When running the testsuite, building stdlib/isomac.c outputs the
>> following warning:
>> 
>>   gcc -O   -D_GNU_SOURCE -DIS_IN_build -include /home/aurel32/glibc-build/config.h isomac.c -o /home/aurel32/glibc-build/stdlib/isomac
>>   isomac.c: In function ‘get_null_defines’:
>>   isomac.c:260:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
>>      close (fd);
>>      ^~~~~
>>      pclose
>> 
>> Fix that by adding the <unistd.h> include.
>> 
>
> Ping, now that master is opened again for development, is this patch
> fine to be committed?

Yes, please.  Patch looks good to me.

Thanks,
Florian
  

Patch

diff --git a/ChangeLog b/ChangeLog
index 909e56a49c..4fef3c1807 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@ 
+2019-01-08  Aurelien Jarno  <aurelien@aurel32.net>
+
+	* stdlib/isomac.c: Include <unistd.h>.
+
 2019-01-07  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #24066]
diff --git a/stdlib/isomac.c b/stdlib/isomac.c
index 37f564c82a..7d743cb8e5 100644
--- a/stdlib/isomac.c
+++ b/stdlib/isomac.c
@@ -74,6 +74,7 @@ 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #define HEADER_MAX          256