summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-roguelike/slashem/files/0.0.6E4F8-errno.patch')
-rw-r--r--games-roguelike/slashem/files/0.0.6E4F8-errno.patch197
1 files changed, 197 insertions, 0 deletions
diff --git a/games-roguelike/slashem/files/0.0.6E4F8-errno.patch b/games-roguelike/slashem/files/0.0.6E4F8-errno.patch
new file mode 100644
index 000000000000..5c05c6f5e4e6
--- /dev/null
+++ b/games-roguelike/slashem/files/0.0.6E4F8-errno.patch
@@ -0,0 +1,197 @@
+diff -Naurd slashem-0.0.6E4F8-old/src/do.c slashem-0.0.6E4F8/src/do.c
+--- slashem-0.0.6E4F8-old/src/do.c 2002-04-01 01:05:53.000000000 +0300
++++ slashem-0.0.6E4F8/src/do.c 2003-07-28 17:21:50.000000000 +0300
+@@ -17,7 +17,7 @@
+ #ifdef _DCC
+ const
+ #endif
+-extern int errno;
++#include <errno.h>
+ #endif
+
+ #ifdef SINKS
+diff -Naurd slashem-0.0.6E4F8-old/src/files.c slashem-0.0.6E4F8/src/files.c
+--- slashem-0.0.6E4F8-old/src/files.c 2002-04-01 01:05:54.000000000 +0300
++++ slashem-0.0.6E4F8/src/files.c 2003-07-28 17:21:33.000000000 +0300
+@@ -17,7 +17,7 @@
+ #if defined(UNIX) || defined(VMS)
+ #include <errno.h>
+ # ifndef SKIP_ERRNO
+-extern int errno;
++#include <errno.h>
+ # endif
+ #include <signal.h>
+ #endif
+diff -Naurd slashem-0.0.6E4F8-old/sys/unix/cpp2.shr slashem-0.0.6E4F8/sys/unix/cpp2.shr
+--- slashem-0.0.6E4F8-old/sys/unix/cpp2.shr 2002-04-01 01:06:10.000000000 +0300
++++ slashem-0.0.6E4F8/sys/unix/cpp2.shr 2003-07-28 17:21:01.000000000 +0300
+@@ -348,6 +348,7 @@
+ X#endif
+ X
+ X#include <stdio.h>
++X#include <errno.h>
+ X#include <ctype.h>
+ X#include "cppdef.h"
+ X#include "cpp.h"
+@@ -1113,7 +1114,6 @@
+ X int i; /* argv[] index */
+ X int j; /* Output index */
+ X int file; /* File_descriptor */
+-X extern int errno; /* Last vms i/o error */
+ X
+ X for (j = i = 1; i < argc; i++) { /* Do all arguments */
+ X switch (*(ap = argv[i])) {
+diff -Naurd slashem-0.0.6E4F8-old/sys/unix/unixres.c slashem-0.0.6E4F8/sys/unix/unixres.c
+--- slashem-0.0.6E4F8-old/sys/unix/unixres.c 2002-04-01 01:06:10.000000000 +0300
++++ slashem-0.0.6E4F8/sys/unix/unixres.c 2003-07-28 17:19:23.000000000 +0300
+@@ -13,51 +13,47 @@
+ * so temporarily dropping privileges on these systems is sufficient to
+ * hide them.
+ */
++#ifdef __GNUC__
++#define _GNU_SOURCE
++#endif
+
+ #include "config.h"
+
+ #ifdef GETRES_SUPPORT
+
+-#if defined(LINUX)
++# if defined(LINUX)
+
+-static _syscall3(int, getresuid, unsigned short *, ruid, \
+- unsigned short *, euid, unsigned short *, suid)
+-static _syscall3(int, getresgid, unsigned short *, rgid, \
+- unsigned short *, egid, unsigned short *, sgid)
++/* requires dynamic linking with libc */
++#include <dlfcn.h>
+
+ static int
+ real_getresuid(ruid, euid, suid)
+ uid_t *ruid, *euid, *suid;
+ {
+- int retval;
+- unsigned short r, e, s;
+- retval = getresuid(&r, &e, &s);
+- if (!retval) {
+- *ruid = r;
+- *euid = e;
+- *suid = s;
+- }
+- return retval;
++ int (*f)(uid_t *, uid_t *, uid_t *); /* getresuid signature */
++
++ f = dlsym(RTLD_NEXT, "getresuid");
++ if (!f) return -1;
++
++ return f(ruid, euid, suid);
+ }
+
+ static int
+ real_getresgid(rgid, egid, sgid)
+ gid_t *rgid, *egid, *sgid;
+ {
+- int retval;
+- unsigned short r, e, s;
+- retval = getresgid(&r, &e, &s);
+- if (!retval) {
+- *rgid = r;
+- *egid = e;
+- *sgid = s;
+- }
+- return retval;
++ int (*f)(gid_t *, gid_t *, gid_t *); /* getresgid signature */
++
++ f = dlsym(RTLD_NEXT, "getresgid");
++ if (!f) return -1;
++
++ return f(rgid, egid, sgid);
+ }
+
+-#elif defined(BSD) || defined(SVR4)
++# else
++# if defined(BSD) || defined(SVR4)
+
+-#ifdef SYS_getresuid
++# ifdef SYS_getresuid
+
+ static int
+ real_getresuid(ruid, euid, suid)
+@@ -66,7 +62,7 @@
+ return syscall(SYS_getresuid, ruid, euid, suid);
+ }
+
+-#else /* SYS_getresuid */
++# else /* SYS_getresuid */
+
+ static int
+ real_getresuid(ruid, euid, suid)
+@@ -88,9 +84,9 @@
+ return retval;
+ }
+
+-#endif /* SYS_getresuid */
++# endif /* SYS_getresuid */
+
+-#ifdef SYS_getresgid
++# ifdef SYS_getresgid
+
+ static int
+ real_getresgid(rgid, egid, sgid)
+@@ -99,7 +95,7 @@
+ return syscall(SYS_getresgid, rgid, egid, sgid);
+ }
+
+-#else /* SYS_getresgid */
++# else /* SYS_getresgid */
+
+ static int
+ real_getresgid(rgid, egid, sgid)
+@@ -121,8 +117,9 @@
+ return retval;
+ }
+
+-#endif /* SYS_getresgid */
+-#endif /* LINUX || BSD || SVR4 */
++# endif /* SYS_getresgid */
++# endif /* BSD || SVR4 */
++# endif /* LINUX */
+
+ static unsigned int hiding_privileges = 0;
+
+@@ -199,11 +196,13 @@
+
+ #else /* GETRES_SUPPORT */
+
++# ifdef GNOME_GRAPHICS
+ int
+ hide_privileges(flag)
+ boolean flag;
+ {
+ return 0;
+ }
++# endif
+
+ #endif /* GETRES_SUPPORT */
+diff -Naurd slashem-0.0.6E4F8-old/sys/unix/unixunix.c slashem-0.0.6E4F8/sys/unix/unixunix.c
+--- slashem-0.0.6E4F8-old/sys/unix/unixunix.c 2002-04-01 01:06:10.000000000 +0300
++++ slashem-0.0.6E4F8/sys/unix/unixunix.c 2003-07-28 17:25:21.000000000 +0300
+@@ -134,7 +134,7 @@
+ #endif
+ if(date - buf.st_mtime < 3L*24L*60L*60L) { /* recent */
+ #ifndef NETWORK
+- extern int errno;
++#include <errno.h>
+ #endif
+ int lockedpid; /* should be the same size as hackpid */
+
+@@ -188,7 +188,8 @@
+ void
+ getlock()
+ {
+- extern int errno;
++/*#include <errno.h>
++ extern int errno;*/
+ register int i = 0, fd, c;
+ #ifndef FILE_AREAS
+ const char *fq_lock;