xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-core/sysvinit/sysvinit/realpath.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From eb158c97f19d473d01befe96359a7f93ae834517 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 Nov 2015 00:10:03 +0000
4Subject: [PATCH] Fix build on musl use realpath() API its available on all
5 libcs
6
7realpath() API doesnt work on systems with PATH_MAX set to be unlimited e.g. GNU/Hurd
8However for Linux it should always work
9
10Upstream-Status: Inappropriate [Linux specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13
14---
15 src/killall5.c   | 4 ++--
16 src/mountpoint.c | 1 +
17 src/wall.c       | 1 +
18 3 files changed, 4 insertions(+), 2 deletions(-)
19
20diff --git a/src/killall5.c b/src/killall5.c
21index a664954..9798423 100644
22--- a/src/killall5.c
23+++ b/src/killall5.c
24@@ -977,9 +977,9 @@ int matches(PROC *o, PROC *p)
25 	char *oargv1, *pargv1;
26 	if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
27 		if (o->argv1 && p->argv1) {
28-			if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
29+			if ((oargv1 = realpath(o->argv1, NULL)) == NULL)
30 				oargv1 = strdup(o->argv1);
31-			if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
32+			if ((pargv1 = realpath(p->argv1, NULL)) == NULL)
33 				pargv1 = strdup(p->argv1);
34 			if (! strcmp(oargv1, pargv1)) {
35 				ret = 1;
36diff --git a/src/mountpoint.c b/src/mountpoint.c
37index b24335e..5f20522 100644
38--- a/src/mountpoint.c
39+++ b/src/mountpoint.c
40@@ -23,6 +23,7 @@
41  *		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
42  */
43
44+#include <sys/types.h>
45 #include <sys/stat.h>
46 #include <unistd.h>
47 #include <stdlib.h>
48diff --git a/src/wall.c b/src/wall.c
49index d3a2c70..00826e9 100644
50--- a/src/wall.c
51+++ b/src/wall.c
52@@ -30,6 +30,7 @@
53 #include <pwd.h>
54 #include <syslog.h>
55 #include <sys/types.h>
56+#include <time.h>
57 #include "init.h"
58
59
60