[PATCH relayd] route: Fix compile warning with glibc
Hauke Mehrtens
hauke at hauke-m.de
Sat Jan 21 09:53:30 PST 2023
This fixes the following compile problem:
````
/route.c: In function 'rtnl_flush':
/route.c:45:15: error: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Werror=unused-result]
45 | (void)write(fd, "-1", 2);
| ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
````
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
route.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/route.c b/route.c
index c552d1f..602fdc9 100644
--- a/route.c
+++ b/route.c
@@ -36,13 +36,16 @@ int route_table = 16800;
static void rtnl_flush(void)
{
+ ssize_t ret;
int fd;
fd = open("/proc/sys/net/ipv4/route/flush", O_WRONLY);
if (fd < 0)
return;
- write(fd, "-1", 2);
+ ret = write(fd, "-1", 2);
+ if (ret != 2)
+ perror("write");
close(fd);
}
--
2.39.0
More information about the openwrt-devel
mailing list