summaryrefslogtreecommitdiff
path: root/shells/bash2/patches
diff options
context:
space:
mode:
authormrg <mrg>2001-08-30 13:56:27 +0000
committermrg <mrg>2001-08-30 13:56:27 +0000
commit05d153e3f622a1bbef75a8cf5dc35a5faaa9f80b (patch)
treed02e78a7bed1b973679bf7443ac7d82587613f9c /shells/bash2/patches
parent09e0950b1e08d1af90a9510a90c17d259df2cbc7 (diff)
downloadpkgsrc-05d153e3f622a1bbef75a8cf5dc35a5faaa9f80b.tar.gz
fix bash on sparc64; the patches are from Shin'ichiro TAYA <taya@ba2.so-net.ne.jp>,
tested by Martti Kuparinen <martti.kuparinen@iki.fi> and myself...
Diffstat (limited to 'shells/bash2/patches')
-rw-r--r--shells/bash2/patches/patch-ac80
-rw-r--r--shells/bash2/patches/patch-ad49
2 files changed, 129 insertions, 0 deletions
diff --git a/shells/bash2/patches/patch-ac b/shells/bash2/patches/patch-ac
new file mode 100644
index 00000000000..3818a702500
--- /dev/null
+++ b/shells/bash2/patches/patch-ac
@@ -0,0 +1,80 @@
+$NetBSD: patch-ac,v 1.5 2001/08/30 13:56:28 mrg Exp $
+
+--- unwind_prot.c.orig Wed Feb 14 23:00:55 2001
++++ unwind_prot.c Thu Aug 30 11:24:44 2001
+@@ -51,7 +51,7 @@
+ points to this. */
+ typedef struct {
+ int *variable;
+- char *desired_setting;
++ UWP desired_setting;
+ int size;
+ } SAVED_VAR;
+
+@@ -280,8 +280,9 @@
+ discard_saved_var (sv)
+ SAVED_VAR *sv;
+ {
+- if (sv->size != sizeof (int))
+- free (sv->desired_setting);
++ if (sv->size != sizeof (int) && sv->size != sizeof (short) &&
++ sv->size != sizeof (char *))
++ free (sv->desired_setting.p);
+ free (sv);
+ }
+
+@@ -293,13 +294,16 @@
+ restore_variable (sv)
+ SAVED_VAR *sv;
+ {
+- if (sv->size != sizeof (int))
+- {
+- FASTCOPY ((char *)sv->desired_setting, (char *)sv->variable, sv->size);
+- free (sv->desired_setting);
+- }
+- else
+- *(sv->variable) = (int)sv->desired_setting;
++ if (sv->size == sizeof (int))
++ *(int *)(sv->variable) = sv->desired_setting.i;
++ else if (sv->size == sizeof (short))
++ *(short *)(sv->variable) = sv->desired_setting.s;
++ else if (sv->size == sizeof (char *))
++ *(char **)(sv->variable) = sv->desired_setting.p;
++ else {
++ FASTCOPY ((char *)sv->desired_setting.p, (char *)sv->variable, sv->size);
++ free (sv->desired_setting.p);
++ }
+
+ free (sv);
+ }
+@@ -312,19 +316,22 @@
+ void
+ unwind_protect_var (var, value, size)
+ int *var;
+- char *value;
++ UWP *value;
+ int size;
+ {
+ SAVED_VAR *s = (SAVED_VAR *)xmalloc (sizeof (SAVED_VAR));
+
+ s->variable = var;
+- if (size != sizeof (int))
+- {
+- s->desired_setting = (char *)xmalloc (size);
+- FASTCOPY (value, (char *)s->desired_setting, size);
+- }
+- else
+- s->desired_setting = value;
++ if (size == sizeof (int)) {
++ s->desired_setting.i = value->i;
++ } else if (size == sizeof (short)) {
++ s->desired_setting.s = value->s;
++ } else if (size == sizeof (char *)) {
++ s->desired_setting.p = value->p;
++ } else {
++ s->desired_setting.p = (char *)xmalloc (size);
++ FASTCOPY (value, (char *)s->desired_setting.p, size);
++ }
+ s->size = size;
+ add_unwind_protect ((Function *)restore_variable, (char *)s);
+ }
diff --git a/shells/bash2/patches/patch-ad b/shells/bash2/patches/patch-ad
new file mode 100644
index 00000000000..ea7dfad5d61
--- /dev/null
+++ b/shells/bash2/patches/patch-ad
@@ -0,0 +1,49 @@
+$NetBSD: patch-ad,v 1.1 2001/08/30 13:56:28 mrg Exp $
+
+--- unwind_prot.h.orig Thu Feb 1 19:51:00 2001
++++ unwind_prot.h Thu Aug 30 11:24:44 2001
+@@ -34,8 +34,9 @@
+ /* Try to force correct alignment on machines where pointers and ints
+ differ in size. */
+ typedef union {
+- char *s;
++ char *p;
+ int i;
++ int s;
+ } UWP;
+
+ /* Define for people who like their code to look a certain way. */
+@@ -47,18 +48,28 @@
+ { \
+ UWP u; \
+ u.i = (X); \
+- unwind_protect_var (&(X), u.s, sizeof (int)); \
++ unwind_protect_var (&(X), &u, sizeof (int)); \
+ } \
+ while (0)
+
+ #define unwind_protect_short(X) \
+- unwind_protect_var ((int *)&(X), (char *)&(X), sizeof (short))
++ do \
++ { \
++ UWP u; \
++ u.i = (X); \
++ unwind_protect_var (&(X), &u, sizeof (int)); \
++ } \
++ while (0)
+
+ /* How to protect a pointer to a string. */
+ #define unwind_protect_string(X) \
+- unwind_protect_var ((int *)&(X), \
+- ((sizeof (char *) == sizeof (int)) ? (char *) (X) : (char *) &(X)), \
+- sizeof (char *))
++ do \
++ { \
++ UWP u; \
++ u.p = (X); \
++ unwind_protect_var (&(X), &u, sizeof (char *)); \
++ } \
++ while (0)
+
+ /* How to protect any old pointer. */
+ #define unwind_protect_pointer(X) unwind_protect_string (X)