1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
From: Christian Kastner <ckk@kvr.at>
Date: Sun, 20 Dec 2015 12:04:41 +0100
Subject: Legacy porting issues
Various fixes, additions or updates regarding portability. These are quite
numerous because the upstream code is from 1993, and does not even assume POSIX
compatibility, which is why we declare it.
Based on the changes originally made by Steve Greenland <stevegr@debian.org>.
Forwarded: no
Last-Update: 2015-12-20
---
Makefile | 2 +-
compat.h | 20 ++++++++++----------
cron.c | 2 +-
do_command.c | 5 +++--
externs.h | 1 +
pathnames.h | 2 +-
popen.c | 2 +-
7 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index 3dab5ad..c4c32ad 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ OPTIM = -g
#(BSD is only needed if <sys/params.h> does not define it, as on ULTRIX)
#COMPAT = -DBSD
# (POSIX)
-#COMPAT = -DPOSIX
+COMPAT = -DPOSIX
#<<lint flags of choice?>>
LINTFLAGS = -hbxa $(INCLUDE) $(COMPAT) $(DEBUGGING)
#<<want to use a nonstandard CC?>>
diff --git a/compat.h b/compat.h
index 528c6d3..9ff3778 100644
--- a/compat.h
+++ b/compat.h
@@ -62,7 +62,7 @@
#endif
#ifndef POSIX
-# if (BSD >= 199103) || defined(__linux) || defined(ultrix) || defined(AIX) ||\
+# if (BSD >= 199103) || defined(__linux__) || defined(ultrix) || defined(AIX) ||\
defined(HPUX) || defined(CONVEX) || defined(IRIX)
# define POSIX
# endif
@@ -76,17 +76,17 @@
/*****************************************************************/
-#if !defined(BSD) && !defined(HPUX) && !defined(CONVEX) && !defined(__linux)
+#if !defined(BSD) && !defined(HPUX) && !defined(CONVEX) && !defined(__linux__) && !defined(__GLIBC__)
# define NEED_VFORK
#endif
-#if (!defined(BSD) || (BSD < 198902)) && !defined(__linux) && \
- !defined(IRIX) && !defined(NeXT) && !defined(HPUX)
+#if (!defined(BSD) || (BSD < 198902)) && !defined(__linux__) && \
+ !defined(IRIX) && !defined(NeXT) && !defined(HPUX) && !defined(__GLIBC__)
# define NEED_STRCASECMP
#endif
-#if (!defined(BSD) || (BSD < 198911)) && !defined(__linux) &&\
- !defined(IRIX) && !defined(UNICOS) && !defined(HPUX)
+#if (!defined(BSD) || (BSD < 198911)) && !defined(__linux__) &&\
+ !defined(IRIX) && !defined(UNICOS) && !defined(HPUX) && !defined(__GLIBC__)
# define NEED_STRDUP
#endif
@@ -102,19 +102,19 @@
# define NEED_SETSID
#endif
-#if (defined(POSIX) && !defined(BSD)) && !defined(__linux)
+#if (defined(POSIX) && !defined(BSD)) && !defined(__linux__) && !defined(__GLIBC__)
# define NEED_GETDTABLESIZE
#endif
-#if (BSD >= 199103)
+#if (BSD >= 199103) || defined(__linux)
# define HAVE_SAVED_UIDS
#endif
-#if !defined(ATT) && !defined(__linux) && !defined(IRIX) && !defined(UNICOS)
+#if (!defined(ATT) && !defined(IRIX) && !defined(UNICOS)) || defined(POSIX)
# define USE_SIGCHLD
#endif
-#if !defined(AIX) && !defined(UNICOS)
+#if !defined(AIX) && !defined(UNICOS) && !defined(POSIX)
# define SYS_TIME_H 1
#else
# define SYS_TIME_H 0
diff --git a/cron.c b/cron.c
index 624c37a..2753a44 100644
--- a/cron.c
+++ b/cron.c
@@ -24,7 +24,7 @@ static char rcsid[] = "$Id: cron.c,v 2.11 1994/01/15 20:43:43 vixie Exp $";
#include "cron.h"
-#include <sys/signal.h>
+#include <signal.h>
#if SYS_TIME_H
# include <sys/time.h>
#else
diff --git a/do_command.c b/do_command.c
index 4083c32..11e157a 100644
--- a/do_command.c
+++ b/do_command.c
@@ -21,7 +21,8 @@ static char rcsid[] = "$Id: do_command.c,v 2.12 1994/01/15 20:43:43 vixie Exp $"
#include "cron.h"
-#include <sys/signal.h>
+#include <signal.h>
+#include <grp.h>
#if defined(sequent)
# include <sys/universe.h>
#endif
@@ -207,7 +208,7 @@ child_process(e, u)
* we set uid, we've lost root privledges.
*/
setgid(e->gid);
-# if defined(BSD)
+# if defined(BSD) || defined(POSIX)
initgroups(env_get("LOGNAME", e->envp), e->gid);
# endif
setuid(e->uid); /* we aren't root after this... */
diff --git a/externs.h b/externs.h
index 3efe605..5d10430 100644
--- a/externs.h
+++ b/externs.h
@@ -20,6 +20,7 @@
# include <unistd.h>
# include <string.h>
# include <dirent.h>
+# include <errno.h>
# define DIR_T struct dirent
# define WAIT_T int
# define WAIT_IS_INT 1
diff --git a/pathnames.h b/pathnames.h
index df6bf1e..04065a0 100644
--- a/pathnames.h
+++ b/pathnames.h
@@ -19,7 +19,7 @@
* $Id: pathnames.h,v 1.3 1994/01/15 20:43:43 vixie Exp $
*/
-#if (defined(BSD)) && (BSD >= 199103) || defined(__linux) || defined(AIX)
+#if (defined(BSD)) && (BSD >= 199103) || defined(__linux__) || defined(AIX) || defined(__GLIBC__)
# include <paths.h>
#endif /*BSD*/
diff --git a/popen.c b/popen.c
index 55708bb..d6c2c75 100644
--- a/popen.c
+++ b/popen.c
@@ -29,7 +29,7 @@ static char sccsid[] = "@(#)popen.c 5.7 (Berkeley) 2/14/89";
#endif /* not lint */
#include "cron.h"
-#include <sys/signal.h>
+#include <signal.h>
#define WANT_GLOBBING 0
|