Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[PATCH 1/2] ipc: add missing unistd.h include

21 views
Skip to first unread message

Dominique Martinet

unread,
Jan 6, 2025, 9:20:27 PMJan 6
to stefan...@swupdate.org, swup...@googlegroups.com, AFIQE ANUAR, Dominique Martinet
From: AFIQE ANUAR <afiqe...@atmark-techno.com>

musl requires unistd.h to be included for close() as specified by POSIX.

This always printed a warning and has become and error since gcc 14:

ipc/network_ipc-if.c: In function 'inst_wait_for_complete':
ipc/network_ipc-if.c:74:17: error: implicit declaration of function 'close'; did you mean 'clone'? [-Wimplicit-function-declaration]
74 | close(*progressfd);
| ^~~~~
| clone

Signed-off-by: AFIQE ANUAR <afiqe...@atmark-techno.com>
Signed-off-by: Dominique Martinet <dominique...@atmark-techno.com>
---
(Noticed this when upgrading to alpine 3.21 which includes gcc 14)

ipc/network_ipc-if.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/ipc/network_ipc-if.c b/ipc/network_ipc-if.c
index 51a99357dd20..7740d1dcc17d 100644
--- a/ipc/network_ipc-if.c
+++ b/ipc/network_ipc-if.c
@@ -12,6 +12,7 @@
#include <signal.h>
#include <pthread.h>
#include <inttypes.h>
+#include <unistd.h>
#include "network_ipc.h"
#include "progress_ipc.h"

--
2.39.5


Dominique Martinet

unread,
Jan 6, 2025, 9:20:30 PMJan 6
to stefan...@swupdate.org, swup...@googlegroups.com, AFIQE ANUAR, Dominique Martinet
close() requires unistd.h include.

Note that musl does not provide FTW_CONTINUE/STOP, so copy_handler cannot
be built on musl anyway; this is only a theorical fix.

Signed-off-by: Dominique Martinet <dominique...@atmark-techno.com>
---
handlers/copy_handler.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/handlers/copy_handler.c b/handlers/copy_handler.c
index 222bc9f5cfd3..f888a43baddc 100644
--- a/handlers/copy_handler.c
+++ b/handlers/copy_handler.c
@@ -24,6 +24,7 @@
#else
#include <linux/fs.h>
#endif
+#include <unistd.h>

#include <pctl.h>
#include "swupdate_image.h"
--
2.39.5


Stefano Babic

unread,
Jan 8, 2025, 2:53:40 PMJan 8
to Dominique Martinet, swup...@googlegroups.com, AFIQE ANUAR
Reviewed-by : Stefano Babic <stefan...@swupdate.org>

Stefano Babic

unread,
Jan 8, 2025, 2:53:57 PMJan 8
to Dominique Martinet, swup...@googlegroups.com, AFIQE ANUAR


On 07.01.25 03:20, Dominique Martinet wrote:
Reviewed-by : Stefano Babic <stefan...@swupdate.org>

Reply all
Reply to author
Forward
0 new messages