From eb158c97f19d473d01befe96359a7f93ae834517 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 Nov 2015 00:10:03 +0000
Subject: [PATCH] Fix build on musl use realpath() API its available on all
 libcs

realpath() API doesnt work on systems with PATH_MAX set to be unlimited e.g. GNU/Hurd
However for Linux it should always work

Upstream-Status: Inappropriate [Linux specific]

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 src/killall5.c   | 4 ++--
 src/mountpoint.c | 1 +
 src/wall.c       | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/killall5.c b/src/killall5.c
index a664954..9798423 100644
--- a/src/killall5.c
+++ b/src/killall5.c
@@ -977,9 +977,9 @@ int matches(PROC *o, PROC *p)
 	char *oargv1, *pargv1;
 	if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
 		if (o->argv1 && p->argv1) {
-			if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
+			if ((oargv1 = realpath(o->argv1, NULL)) == NULL)
 				oargv1 = strdup(o->argv1);
-			if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
+			if ((pargv1 = realpath(p->argv1, NULL)) == NULL)
 				pargv1 = strdup(p->argv1);
 			if (! strcmp(oargv1, pargv1)) {
 				ret = 1;
diff --git a/src/mountpoint.c b/src/mountpoint.c
index b24335e..5f20522 100644
--- a/src/mountpoint.c
+++ b/src/mountpoint.c
@@ -23,6 +23,7 @@
  *		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdlib.h>
diff --git a/src/wall.c b/src/wall.c
index d3a2c70..00826e9 100644
--- a/src/wall.c
+++ b/src/wall.c
@@ -30,6 +30,7 @@
 #include <pwd.h>
 #include <syslog.h>
 #include <sys/types.h>
+#include <time.h>
 #include "init.h"
 
 
