Restore cleaning routines in case of an error (bsc#1151630)

OBS-URL: https://build.opensuse.org/package/show/shells/tcsh?expand=0&rev=83
This commit is contained in:
Dr. Werner Fink 2019-09-26 08:01:07 +00:00 committed by Git OBS Bridge
parent b895230f54
commit 6318af0ded
3 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,49 @@
---
sh.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
--- sh.c
+++ sh.c 2019-09-26 07:54:47.733054241 +0000
@@ -1563,13 +1563,15 @@ srcfile(const char *f, int onlyown, int
fl.l_len = 0;
hd = xmalloc(sizeof(*hd));
- cleanup_push(hd, xfree);
+ if (hd) {
+ cleanup_push(hd, xfree);
- *hd = fcntl(unit, F_DUPFD_CLOEXEC, FSAFE+1);
- cleanup_push(hd, open_cleanup);
+ *hd = fcntl(unit, F_DUPFD_CLOEXEC, FSAFE+1);
+ cleanup_push(hd, open_cleanup);
- fcntl(*hd, F_SETLKW, &fl);
- cleanup_push(hd, fcntl_cleanup);
+ fcntl(*hd, F_SETLKW, &fl);
+ cleanup_push(hd, fcntl_cleanup);
+ }
}
cleanup_push(&unit, open_cleanup);
@@ -2229,6 +2231,7 @@ dosource_flg(Char **t, struct command *c
char *file;
int fd;
int newflg = 0;
+ size_t omark;
USE(c);
t++;
@@ -2249,9 +2252,12 @@ dosource_flg(Char **t, struct command *c
xfree(f);
t = glob_all_or_error(t);
cleanup_push(t, blk_cleanup);
+ omark = cleanup_push_mark();
fd = srcfile(file, 0, (flg | newflg), t);
- if ((!fd) && (!newflg) && (!bequiet))
+ if ((!fd) && (!newflg) && (!bequiet)) {
+ omark = cleanup_push_mark();
stderror(ERR_SYSTEM, file, strerror(errno));
+ }
/* We need to preserve fd and it's cleaning routines on the top of the
* cleaning stack. Don't call cleanup_until() but clean it manually. */
cleanup_ignore(file);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 26 07:39:20 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Add patch tcsh-6.18.01-history-stderror-jmp.patch to restore
cleanup routines in case of an error (bsc#1151630)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Aug 22 12:27:18 UTC 2019 - Dr. Werner Fink <werner@suse.de> Thu Aug 22 12:27:18 UTC 2019 - Dr. Werner Fink <werner@suse.de>

View File

@ -41,6 +41,8 @@ Patch10: tcsh-6.18.03-history-merge.dif
Patch11: tcsh-6.19.00-history-file-locking-order.patch Patch11: tcsh-6.19.00-history-file-locking-order.patch
# PATCH-FIX-SUSE Aoid dot locking as patch 9 and 11 do the job better # PATCH-FIX-SUSE Aoid dot locking as patch 9 and 11 do the job better
Patch12: tcsh-6.20.00-avoid-dotlock-for-fcntl.patch Patch12: tcsh-6.20.00-avoid-dotlock-for-fcntl.patch
# PATCH-FIX-SUSE Restore cleaning routines in case of an error (bsc#1151630)
Patch13: tcsh-6.18.01-history-stderror-jmp.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
@ -71,6 +73,7 @@ correction, a history mechanism, job control, and a C-like syntax.
%patch10 -b .histmerg %patch10 -b .histmerg
%patch11 -b .histlckord %patch11 -b .histlckord
%patch12 -p0 -b .nodtlck %patch12 -p0 -b .nodtlck
%patch13 -p0 -b .histerrjmp
%patch0 -b .0 %patch0 -b .0
%build %build