diff mbox series

[meta-security] tcp-smack-test/udp-smack-test: fix do_compile failure

Message ID 20240528054424.4037114-1-changqing.li@windriver.com
State New
Headers show
Series [meta-security] tcp-smack-test/udp-smack-test: fix do_compile failure | expand

Commit Message

Changqing Li May 28, 2024, 5:44 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

Include proper headers to fix following errors:
| udp_client.c:41:16: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
|    41 |         port = atoi(argv[1]);
| udp_client.c:52:12: error: implicit declaration of function 'fsetxattr' [-Wimplicit-function-declaration]
|    52 |         if(fsetxattr(sock, attr, label, strlen(label),0) < 0)
|       |            ^~~~~~~~~
| udp_client.c:67:9: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
|    67 |         close(sock);
|       |         ^~~~~
|       |         pclose
| tcp_client.c:55:16: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
|    55 |         port = atoi(argv[1]);
...

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 recipes-mac/smack/tcp-smack-test/tcp_client.c | 1 +
 recipes-mac/smack/tcp-smack-test/tcp_server.c | 3 +++
 recipes-mac/smack/udp-smack-test/udp_client.c | 3 +++
 recipes-mac/smack/udp-smack-test/udp_server.c | 3 +++
 4 files changed, 10 insertions(+)

Comments

akuster808 May 28, 2024, 6:16 p.m. UTC | #1
Hello Changging,

Martin sent a patch to fix this earlier.

thanks.
Armin

On 5/28/24 1:44 AM, Changqing Li via lists.yoctoproject.org wrote:
> From: Changqing Li <changqing.li@windriver.com>
>
> Include proper headers to fix following errors:
> | udp_client.c:41:16: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
> |    41 |         port = atoi(argv[1]);
> | udp_client.c:52:12: error: implicit declaration of function 'fsetxattr' [-Wimplicit-function-declaration]
> |    52 |         if(fsetxattr(sock, attr, label, strlen(label),0) < 0)
> |       |            ^~~~~~~~~
> | udp_client.c:67:9: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
> |    67 |         close(sock);
> |       |         ^~~~~
> |       |         pclose
> | tcp_client.c:55:16: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
> |    55 |         port = atoi(argv[1]);
> ...
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>   recipes-mac/smack/tcp-smack-test/tcp_client.c | 1 +
>   recipes-mac/smack/tcp-smack-test/tcp_server.c | 3 +++
>   recipes-mac/smack/udp-smack-test/udp_client.c | 3 +++
>   recipes-mac/smack/udp-smack-test/udp_server.c | 3 +++
>   4 files changed, 10 insertions(+)
>
> diff --git a/recipes-mac/smack/tcp-smack-test/tcp_client.c b/recipes-mac/smack/tcp-smack-test/tcp_client.c
> index 6c0a474..b82b575 100644
> --- a/recipes-mac/smack/tcp-smack-test/tcp_client.c
> +++ b/recipes-mac/smack/tcp-smack-test/tcp_client.c
> @@ -18,6 +18,7 @@
>   // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
>   // THE SOFTWARE.
>   #include <stdio.h>
> +#include <stdlib.h>
>   #include <sys/socket.h>
>   #include <sys/types.h>
>   #include <errno.h>
> diff --git a/recipes-mac/smack/tcp-smack-test/tcp_server.c b/recipes-mac/smack/tcp-smack-test/tcp_server.c
> index 3c8921f..6de7ccd 100644
> --- a/recipes-mac/smack/tcp-smack-test/tcp_server.c
> +++ b/recipes-mac/smack/tcp-smack-test/tcp_server.c
> @@ -24,6 +24,9 @@
>   #include <netinet/in.h>
>   #include <unistd.h>
>   #include <string.h>
> +#include <stdlib.h>
> +#include <sys/xattr.h>
> +
>   
>   int main(int argc, char* argv[])
>   {
> diff --git a/recipes-mac/smack/udp-smack-test/udp_client.c b/recipes-mac/smack/udp-smack-test/udp_client.c
> index 23f3e00..3d2ee31 100644
> --- a/recipes-mac/smack/udp-smack-test/udp_client.c
> +++ b/recipes-mac/smack/udp-smack-test/udp_client.c
> @@ -19,6 +19,9 @@
>   // THE SOFTWARE.
>   #include <sys/socket.h>
>   #include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <sys/xattr.h>
>   #include <netinet/in.h>
>   #include <netdb.h>
>   #include <string.h>
> diff --git a/recipes-mac/smack/udp-smack-test/udp_server.c b/recipes-mac/smack/udp-smack-test/udp_server.c
> index 7d2fcf5..25ad1ef 100644
> --- a/recipes-mac/smack/udp-smack-test/udp_server.c
> +++ b/recipes-mac/smack/udp-smack-test/udp_server.c
> @@ -22,6 +22,9 @@
>   #include <netinet/in.h>
>   #include <netdb.h>
>   #include <string.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <sys/xattr.h>
>   
>   int main(int argc, char* argv[])
>   {
Changqing Li May 29, 2024, 2:46 a.m. UTC | #2
On 5/29/24 02:16, akuster808 wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender 
> and know the content is safe.
>
>  Hello Changging,
>
> Martin sent a patch to fix this earlier.
>
> thanks.
> Armin

Hi, Armin

Thanks. I just saw Martin's patch on master-next, but seems like not all 
the needed header is added in that patch.

Maybe there will be compile error for these recipes.

Changqing

>
> On 5/28/24 1:44 AM, Changqing Li via lists.yoctoproject.org wrote:
>> From: Changqing Li <changqing.li@windriver.com>
>>
>> Include proper headers to fix following errors:
>> | udp_client.c:41:16: error: implicit declaration of function 'atoi' 
>> [-Wimplicit-function-declaration]
>> |    41 |         port = atoi(argv[1]);
>> | udp_client.c:52:12: error: implicit declaration of function 
>> 'fsetxattr' [-Wimplicit-function-declaration]
>> |    52 |         if(fsetxattr(sock, attr, label, strlen(label),0) < 0)
>> |       |            ^~~~~~~~~
>> | udp_client.c:67:9: error: implicit declaration of function 'close'; 
>> did you mean 'pclose'? [-Wimplicit-function-declaration]
>> |    67 |         close(sock);
>> |       |         ^~~~~
>> |       |         pclose
>> | tcp_client.c:55:16: error: implicit declaration of function 'atoi' 
>> [-Wimplicit-function-declaration]
>> |    55 |         port = atoi(argv[1]);
>> ...
>>
>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>> ---
>>   recipes-mac/smack/tcp-smack-test/tcp_client.c | 1 +
>>   recipes-mac/smack/tcp-smack-test/tcp_server.c | 3 +++
>>   recipes-mac/smack/udp-smack-test/udp_client.c | 3 +++
>>   recipes-mac/smack/udp-smack-test/udp_server.c | 3 +++
>>   4 files changed, 10 insertions(+)
>>
>> diff --git a/recipes-mac/smack/tcp-smack-test/tcp_client.c 
>> b/recipes-mac/smack/tcp-smack-test/tcp_client.c
>> index 6c0a474..b82b575 100644
>> --- a/recipes-mac/smack/tcp-smack-test/tcp_client.c
>> +++ b/recipes-mac/smack/tcp-smack-test/tcp_client.c
>> @@ -18,6 +18,7 @@
>>   // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
>> DEALINGS IN
>>   // THE SOFTWARE.
>>   #include <stdio.h>
>> +#include <stdlib.h>
>>   #include <sys/socket.h>
>>   #include <sys/types.h>
>>   #include <errno.h>
>> diff --git a/recipes-mac/smack/tcp-smack-test/tcp_server.c 
>> b/recipes-mac/smack/tcp-smack-test/tcp_server.c
>> index 3c8921f..6de7ccd 100644
>> --- a/recipes-mac/smack/tcp-smack-test/tcp_server.c
>> +++ b/recipes-mac/smack/tcp-smack-test/tcp_server.c
>> @@ -24,6 +24,9 @@
>>   #include <netinet/in.h>
>>   #include <unistd.h>
>>   #include <string.h>
>> +#include <stdlib.h>
>> +#include <sys/xattr.h>
>> +
>>
>>   int main(int argc, char* argv[])
>>   {
>> diff --git a/recipes-mac/smack/udp-smack-test/udp_client.c 
>> b/recipes-mac/smack/udp-smack-test/udp_client.c
>> index 23f3e00..3d2ee31 100644
>> --- a/recipes-mac/smack/udp-smack-test/udp_client.c
>> +++ b/recipes-mac/smack/udp-smack-test/udp_client.c
>> @@ -19,6 +19,9 @@
>>   // THE SOFTWARE.
>>   #include <sys/socket.h>
>>   #include <stdio.h>
>> +#include <stdlib.h>
>> +#include <unistd.h>
>> +#include <sys/xattr.h>
>>   #include <netinet/in.h>
>>   #include <netdb.h>
>>   #include <string.h>
>> diff --git a/recipes-mac/smack/udp-smack-test/udp_server.c 
>> b/recipes-mac/smack/udp-smack-test/udp_server.c
>> index 7d2fcf5..25ad1ef 100644
>> --- a/recipes-mac/smack/udp-smack-test/udp_server.c
>> +++ b/recipes-mac/smack/udp-smack-test/udp_server.c
>> @@ -22,6 +22,9 @@
>>   #include <netinet/in.h>
>>   #include <netdb.h>
>>   #include <string.h>
>> +#include <stdlib.h>
>> +#include <unistd.h>
>> +#include <sys/xattr.h>
>>
>>   int main(int argc, char* argv[])
>>   {
>
Changqing Li May 29, 2024, 3:10 a.m. UTC | #3
On 5/29/24 10:46, Changqing Li wrote:
>
>
> On 5/29/24 02:16, akuster808 wrote:
>> CAUTION: This email comes from a non Wind River email account!
>> Do not click links or open attachments unless you recognize the 
>> sender and know the content is safe.
>>
>>  Hello Changging,
>>
>> Martin sent a patch to fix this earlier.
>>
>> thanks.
>> Armin
>
> Hi, Armin
>
> Thanks. I just saw Martin's patch on master-next, but seems like not 
> all the needed header is added in that patch.
>
> Maybe there will be compile error for these recipes.
>
Should I send a patch based on Martin's patch?

Thanks

Changqing

> Changqing
>
>>
>> On 5/28/24 1:44 AM, Changqing Li via lists.yoctoproject.org 
>> <https://urldefense.com/v3/__http://lists.yoctoproject.org__;!!AjveYdw8EvQ!eGfBaYJsXLlZaaX4RSJ9li6ztnC7C5RsWG_o6EU-6gJj0Go6kivGpd3QPGIoKwZGz8rxUCN_SFxGvybJ3DQ1P06l764F63Aau4EFFg$> 
>> wrote:
>>> From: Changqing Li <changqing.li@windriver.com>
>>>
>>> Include proper headers to fix following errors:
>>> | udp_client.c:41:16: error: implicit declaration of function 'atoi' 
>>> [-Wimplicit-function-declaration]
>>> |    41 |         port = atoi(argv[1]);
>>> | udp_client.c:52:12: error: implicit declaration of function 
>>> 'fsetxattr' [-Wimplicit-function-declaration]
>>> |    52 |         if(fsetxattr(sock, attr, label, strlen(label),0) < 0)
>>> |       |            ^~~~~~~~~
>>> | udp_client.c:67:9: error: implicit declaration of function 
>>> 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
>>> |    67 |         close(sock);
>>> |       |         ^~~~~
>>> |       |         pclose
>>> | tcp_client.c:55:16: error: implicit declaration of function 'atoi' 
>>> [-Wimplicit-function-declaration]
>>> |    55 |         port = atoi(argv[1]);
>>> ...
>>>
>>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>>> ---
>>>   recipes-mac/smack/tcp-smack-test/tcp_client.c | 1 +
>>>   recipes-mac/smack/tcp-smack-test/tcp_server.c | 3 +++
>>>   recipes-mac/smack/udp-smack-test/udp_client.c | 3 +++
>>>   recipes-mac/smack/udp-smack-test/udp_server.c | 3 +++
>>>   4 files changed, 10 insertions(+)
>>>
>>> diff --git a/recipes-mac/smack/tcp-smack-test/tcp_client.c 
>>> b/recipes-mac/smack/tcp-smack-test/tcp_client.c
>>> index 6c0a474..b82b575 100644
>>> --- a/recipes-mac/smack/tcp-smack-test/tcp_client.c
>>> +++ b/recipes-mac/smack/tcp-smack-test/tcp_client.c
>>> @@ -18,6 +18,7 @@
>>>   // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
>>> DEALINGS IN
>>>   // THE SOFTWARE.
>>>   #include <stdio.h>
>>> +#include <stdlib.h>
>>>   #include <sys/socket.h>
>>>   #include <sys/types.h>
>>>   #include <errno.h>
>>> diff --git a/recipes-mac/smack/tcp-smack-test/tcp_server.c 
>>> b/recipes-mac/smack/tcp-smack-test/tcp_server.c
>>> index 3c8921f..6de7ccd 100644
>>> --- a/recipes-mac/smack/tcp-smack-test/tcp_server.c
>>> +++ b/recipes-mac/smack/tcp-smack-test/tcp_server.c
>>> @@ -24,6 +24,9 @@
>>>   #include <netinet/in.h>
>>>   #include <unistd.h>
>>>   #include <string.h>
>>> +#include <stdlib.h>
>>> +#include <sys/xattr.h>
>>> +
>>>
>>>   int main(int argc, char* argv[])
>>>   {
>>> diff --git a/recipes-mac/smack/udp-smack-test/udp_client.c 
>>> b/recipes-mac/smack/udp-smack-test/udp_client.c
>>> index 23f3e00..3d2ee31 100644
>>> --- a/recipes-mac/smack/udp-smack-test/udp_client.c
>>> +++ b/recipes-mac/smack/udp-smack-test/udp_client.c
>>> @@ -19,6 +19,9 @@
>>>   // THE SOFTWARE.
>>>   #include <sys/socket.h>
>>>   #include <stdio.h>
>>> +#include <stdlib.h>
>>> +#include <unistd.h>
>>> +#include <sys/xattr.h>
>>>   #include <netinet/in.h>
>>>   #include <netdb.h>
>>>   #include <string.h>
>>> diff --git a/recipes-mac/smack/udp-smack-test/udp_server.c 
>>> b/recipes-mac/smack/udp-smack-test/udp_server.c
>>> index 7d2fcf5..25ad1ef 100644
>>> --- a/recipes-mac/smack/udp-smack-test/udp_server.c
>>> +++ b/recipes-mac/smack/udp-smack-test/udp_server.c
>>> @@ -22,6 +22,9 @@
>>>   #include <netinet/in.h>
>>>   #include <netdb.h>
>>>   #include <string.h>
>>> +#include <stdlib.h>
>>> +#include <unistd.h>
>>> +#include <sys/xattr.h>
>>>
>>>   int main(int argc, char* argv[])
>>>   {
>>
> _._,_._,_
> ------------------------------------------------------------------------
> Links:
>
> You receive all messages sent to this group.
>
> View/Reply Online (#239) 
> <https://urldefense.com/v3/__https://lists.yoctoproject.org/g/yocto-patches/message/239__;!!AjveYdw8EvQ!eGfBaYJsXLlZaaX4RSJ9li6ztnC7C5RsWG_o6EU-6gJj0Go6kivGpd3QPGIoKwZGz8rxUCN_SFxGvybJ3DQ1P06l764F63BlfKSNJA$> 
> | Reply To Group 
> <mailto:yocto-patches@lists.yoctoproject.org?subject=Re:%20Re%3A%20%5Byocto-patches%5D%20%5Bmeta-security%5D%5BPATCH%5D%20tcp-smack-test%2Fudp-smack-test%3A%20fix%20do_compile%20failure> 
> | Reply To Sender 
> <mailto:changqing.li@eng.windriver.com?subject=Private:%20Re:%20Re%3A%20%5Byocto-patches%5D%20%5Bmeta-security%5D%5BPATCH%5D%20tcp-smack-test%2Fudp-smack-test%3A%20fix%20do_compile%20failure> 
> | Mute This Topic 
> <https://urldefense.com/v3/__https://lists.yoctoproject.org/mt/106344028/3616873__;!!AjveYdw8EvQ!eGfBaYJsXLlZaaX4RSJ9li6ztnC7C5RsWG_o6EU-6gJj0Go6kivGpd3QPGIoKwZGz8rxUCN_SFxGvybJ3DQ1P06l764F63Cq4ktsZw$> 
> | New Topic 
> <https://urldefense.com/v3/__https://lists.yoctoproject.org/g/yocto-patches/post__;!!AjveYdw8EvQ!eGfBaYJsXLlZaaX4RSJ9li6ztnC7C5RsWG_o6EU-6gJj0Go6kivGpd3QPGIoKwZGz8rxUCN_SFxGvybJ3DQ1P06l764F63DB4jdNLg$> 
>
> Your Subscription 
> <https://urldefense.com/v3/__https://lists.yoctoproject.org/g/yocto-patches/editsub/3616873__;!!AjveYdw8EvQ!eGfBaYJsXLlZaaX4RSJ9li6ztnC7C5RsWG_o6EU-6gJj0Go6kivGpd3QPGIoKwZGz8rxUCN_SFxGvybJ3DQ1P06l764F63DfYL6wfg$> 
> | Contact Group Owner 
> <mailto:yocto-patches+owner@lists.yoctoproject.org> | Unsubscribe 
> <https://urldefense.com/v3/__https://lists.yoctoproject.org/g/yocto-patches/leave/13170723/3616873/476927670/xyzzy__;!!AjveYdw8EvQ!eGfBaYJsXLlZaaX4RSJ9li6ztnC7C5RsWG_o6EU-6gJj0Go6kivGpd3QPGIoKwZGz8rxUCN_SFxGvybJ3DQ1P06l764F63C6a56Nwg$> 
> [changqing.li@eng.windriver.com]
>
> _._,_._,_
diff mbox series

Patch

diff --git a/recipes-mac/smack/tcp-smack-test/tcp_client.c b/recipes-mac/smack/tcp-smack-test/tcp_client.c
index 6c0a474..b82b575 100644
--- a/recipes-mac/smack/tcp-smack-test/tcp_client.c
+++ b/recipes-mac/smack/tcp-smack-test/tcp_client.c
@@ -18,6 +18,7 @@ 
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <errno.h>
diff --git a/recipes-mac/smack/tcp-smack-test/tcp_server.c b/recipes-mac/smack/tcp-smack-test/tcp_server.c
index 3c8921f..6de7ccd 100644
--- a/recipes-mac/smack/tcp-smack-test/tcp_server.c
+++ b/recipes-mac/smack/tcp-smack-test/tcp_server.c
@@ -24,6 +24,9 @@ 
 #include <netinet/in.h>
 #include <unistd.h>
 #include <string.h>
+#include <stdlib.h>
+#include <sys/xattr.h>
+
 
 int main(int argc, char* argv[])
 {
diff --git a/recipes-mac/smack/udp-smack-test/udp_client.c b/recipes-mac/smack/udp-smack-test/udp_client.c
index 23f3e00..3d2ee31 100644
--- a/recipes-mac/smack/udp-smack-test/udp_client.c
+++ b/recipes-mac/smack/udp-smack-test/udp_client.c
@@ -19,6 +19,9 @@ 
 // THE SOFTWARE.
 #include <sys/socket.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/xattr.h>
 #include <netinet/in.h>
 #include <netdb.h>
 #include <string.h>
diff --git a/recipes-mac/smack/udp-smack-test/udp_server.c b/recipes-mac/smack/udp-smack-test/udp_server.c
index 7d2fcf5..25ad1ef 100644
--- a/recipes-mac/smack/udp-smack-test/udp_server.c
+++ b/recipes-mac/smack/udp-smack-test/udp_server.c
@@ -22,6 +22,9 @@ 
 #include <netinet/in.h>
 #include <netdb.h>
 #include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/xattr.h>
 
 int main(int argc, char* argv[])
 {