2007-07-23 21:31:32 +02:00
|
|
|
--- sh.h
|
2010-02-18 16:59:51 +01:00
|
|
|
+++ sh.h 2007-07-23 10:01:10.230408643 +0000
|
2007-07-23 21:31:32 +02:00
|
|
|
@@ -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
|
2010-02-18 16:59:51 +01:00
|
|
|
+++ sh.c 2007-07-23 10:02:41.640206073 +0000
|
2007-07-23 21:31:32 +02:00
|
|
|
@@ -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 */
|
2010-02-18 16:59:51 +01:00
|
|
|
@@ -2013,7 +2015,10 @@ process(int catch)
|
2007-07-23 21:31:32 +02:00
|
|
|
#endif /* SIG_WINDOW */
|
|
|
|
setcopy(STR_, InputBuf, VAR_READWRITE | VAR_NOGLOB);
|
|
|
|
cmd_done:
|
|
|
|
- cleanup_until(¶ml);
|
|
|
|
+ if (cleanup_reset())
|
|
|
|
+ cleanup_until(¶ml);
|
|
|
|
+ else
|
|
|
|
+ haderr = 1;
|
|
|
|
}
|
|
|
|
cleanup_pop_mark(omark);
|
2009-12-16 10:50:42 +01:00
|
|
|
resexit(osetexit);
|
2007-07-23 21:31:32 +02:00
|
|
|
--- sh.decls.h
|
2010-02-18 16:59:51 +01:00
|
|
|
+++ sh.decls.h 2007-07-23 13:37:27.493023737 +0000
|
2007-07-23 21:31:32 +02:00
|
|
|
@@ -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
|
2010-02-18 16:59:51 +01:00
|
|
|
+++ sh.err.c 2007-07-23 13:39:48.944172212 +0000
|
2007-07-23 21:31:32 +02:00
|
|
|
@@ -448,6 +448,12 @@ cleanup_until(void *last_var)
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
+int
|
|
|
|
+cleanup_reset(void)
|
|
|
|
+{
|
|
|
|
+ return (cleanup_sp > cleanup_mark);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
void
|
|
|
|
cleanup_until_mark(void)
|
|
|
|
{
|