tcsh/tcsh-6.15.00-longjmp.dif

78 lines
2.0 KiB
Plaintext

--- sh.h
+++ sh.h 2007-07-23 12:01:10.230408643 +0200
@@ -640,7 +640,7 @@ EXTERN int SHDIAG IZERO; /* Diagnostic
EXTERN int OLDSTD IZERO; /* Old standard input (def for cmds) */
-#if SYSVREL == 4 && defined(_UTS)
+#if (SYSVREL == 4 && defined(_UTS)) || defined(__linux__)
/*
* From: fadden@uts.amdahl.com (Andy McFadden)
* we need sigsetjmp for UTS4, but not UTS2.1
@@ -658,7 +658,7 @@ EXTERN int OLDSTD IZERO; /* Old standa
#ifdef SIGSETJMP
typedef struct { sigjmp_buf j; } jmp_buf_t;
-# define setexit() sigsetjmp(reslab.j)
+# define setexit() sigsetjmp(reslab.j, 1)
# define _reset() siglongjmp(reslab.j, 1)
#else
typedef struct { jmp_buf j; } jmp_buf_t;
--- sh.c
+++ sh.c 2007-07-23 12:02:41.640206073 +0200
@@ -78,7 +78,7 @@ extern int NLSMapsAreInited;
* ported to Apple Unix (TM) (OREO) 26 -- 29 Jun 1987
*/
-jmp_buf_t reslab INIT_ZERO_STRUCT;
+jmp_buf_t reslab;
static const char tcshstr[] = "tcsh";
@@ -178,6 +178,8 @@ main(int argc, char **argv)
int osetintr;
struct sigaction oparintr;
+ memset(&reslab, 0, sizeof(reslab));
+
#ifdef WINNT_NATIVE
nt_init();
#endif /* WINNT_NATIVE */
@@ -2026,7 +2028,10 @@ process(int catch)
#endif /* SIG_WINDOW */
setcopy(STR_, InputBuf, VAR_READWRITE | VAR_NOGLOB);
cmd_done:
- cleanup_until(&paraml);
+ if (cleanup_reset())
+ cleanup_until(&paraml);
+ else
+ haderr = 1;
}
exitset--;
cleanup_pop_mark(omark);
--- sh.decls.h
+++ sh.decls.h 2007-07-23 15:37:27.493023737 +0200
@@ -90,6 +90,7 @@ extern void cleanup_push_internal(voi
#define cleanup_push(v, f) cleanup_push_internal(v, f)
#endif
);
+extern int cleanup_reset (void);
extern void cleanup_ignore(void *);
extern void cleanup_until (void *);
extern void cleanup_until_mark(void);
--- sh.err.c
+++ sh.err.c 2007-07-23 15:39:48.944172212 +0200
@@ -448,6 +448,12 @@ cleanup_until(void *last_var)
abort();
}
+int
+cleanup_reset(void)
+{
+ return (cleanup_sp > cleanup_mark);
+}
+
void
cleanup_until_mark(void)
{