linux-atm: Fix build with hardening flags

Port to build on musl while here

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
Khem Raj
2017-06-18 18:05:14 -07:00
committed by Joe MacDonald
parent 487481d48f
commit cf9a6a2bbc
4 changed files with 104 additions and 0 deletions
@@ -0,0 +1,34 @@
From b83fd54584fabd5d24f6645b4a3cf345c9d2020d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 17 Jun 2017 16:11:59 -0700
Subject: [PATCH 1/3] ttcp: Add printf format string
Fixes compiler warnings when format security is enabled
| ../../../linux-atm-2.5.2/src/test/ttcp.c:666:21: error: format not a string literal and no format arguments [-Werror=format-security]
| fprintf(stderr, Usage);
| ^~~~~
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/test/ttcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/ttcp.c b/src/test/ttcp.c
index acb9185..337cee5 100644
--- a/src/test/ttcp.c
+++ b/src/test/ttcp.c
@@ -663,7 +663,7 @@ int no_check = 0;
exit(0);
usage:
- fprintf(stderr, Usage);
+ fprintf(stderr, "%s", Usage);
exit(1);
}
--
2.13.1
@@ -0,0 +1,30 @@
From 27fa80dc8045e71c30dd2abea835206d5c8f6c71 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 17 Jun 2017 16:18:56 -0700
Subject: [PATCH 2/3] sigd: Replace on_exit() API with atexit()
on_exit is not universally available
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/sigd/atmsigd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sigd/atmsigd.c b/src/sigd/atmsigd.c
index 52e41c7..b766606 100644
--- a/src/sigd/atmsigd.c
+++ b/src/sigd/atmsigd.c
@@ -517,7 +517,7 @@ int main(int argc,char **argv)
exit(0);
}
}
- (void) on_exit(trace_on_exit,NULL);
+ atexit(trace_on_exit);
poll_loop();
close_all();
for (sig = entities; sig; sig = sig->next) stop_saal(&sig->saal);
--
2.13.1
@@ -0,0 +1,37 @@
From fe954b2fb17d813aaab3e926cee76144314a115a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 17 Jun 2017 16:22:55 -0700
Subject: [PATCH 3/3] mpoad: Drop old hack to compile with very old glibc
Use poll.h instead of sys/poll.h
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/mpoad/io.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/mpoad/io.c b/src/mpoad/io.c
index 69900c2..8d1433f 100644
--- a/src/mpoad/io.c
+++ b/src/mpoad/io.c
@@ -10,14 +10,7 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/param.h> /* for OPEN_MAX */
-#if __GLIBC__ >= 2
-#include <sys/poll.h>
-#else /* ugly hack to make it compile on RH 4.2 - WA */
-#include <syscall.h>
-#include <linux/poll.h>
-#define SYS_poll 168
-_syscall3(int,poll,struct pollfd *,ufds,unsigned int,nfds,int,timeout);
-#endif
+#include <poll.h>
#include <atm.h>
#include <linux/types.h>
#include <linux/atmioc.h>
--
2.13.1
@@ -11,6 +11,9 @@ SRC_URI = "http://nchc.dl.sourceforge.net/project/${BPN}/${BPN}/${PV}/${BPN}-${P
file://link-with-ldflags.patch \
file://install-from-buildir.patch \
file://0001-fix-compile-error-with-linux-kernel-v4.8.patch \
file://0001-ttcp-Add-printf-format-string.patch \
file://0002-sigd-Replace-on_exit-API-with-atexit.patch \
file://0003-mpoad-Drop-old-hack-to-compile-with-very-old-glibc.patch \
"
SRC_URI[md5sum] = "d49499368c3cf15f73a05d9bce8824a8"