- Fix error handling in tcsh-6.14.00-wide-seeks.patch

This commit is contained in:
Miloslav Trmac 2006-09-26 16:36:32 +00:00
parent 6c0b69de07
commit 53e5ec8613
2 changed files with 23 additions and 9 deletions

View File

@ -1,5 +1,5 @@
--- tcsh/sh.h 2005-03-25 19:46:41.000000000 +0100
+++ tcsh-6.14.00/sh.h 2006-07-03 03:45:30.000000000 +0200
--- tcsh-6.14.00/sh.h.wide-seeks 2005-03-25 19:46:41.000000000 +0100
+++ tcsh-6.14.00/sh.h 2006-09-26 18:26:33.000000000 +0200
@@ -801,6 +801,13 @@
* exactly one if the input is seekable and tell is available.
* In other cases, the shell buffers enough blocks to keep all loops
@ -23,21 +23,32 @@
Char* _c_seek;
} fc;
#define f_seek fc._f_seek
diff -u tcsh-6.14.00/sh.lex.c tcsh-6.14.00/sh.lex.c
--- tcsh-6.14.00/sh.lex.c 2006-07-03 03:46:11.000000000 +0200
+++ tcsh-6.14.00/sh.lex.c 2006-07-05 16:31:51.000000000 +0200
@@ -1736,7 +1736,9 @@
--- tcsh-6.14.00/sh.lex.c.wide-seeks 2006-09-26 18:26:33.000000000 +0200
+++ tcsh-6.14.00/sh.lex.c 2006-09-26 18:28:10.000000000 +0200
@@ -1694,7 +1694,8 @@
char cbuf[BUFSIZE + 1];
ssize_t res, r;
size_t partial;
-
+ int err;
+
assert (nchars <= sizeof(cbuf)/sizeof(*cbuf));
USE(use_fclens);
res = 0;
@@ -1736,7 +1737,11 @@
memmove(cbuf, cbuf + i, partial - i);
partial -= i;
} while (partial != 0 && nchars != 0);
- /* Throwing away possible partial multibyte characters on error */
+ /* Throwing away possible partial multibyte characters on error if the
+ stream is not seekable */
+ err = errno;
+ lseek(fildes, -(off_t)partial, L_INCR);
+ errno = err;
return res != 0 ? res : r;
}
@@ -1753,7 +1755,13 @@
@@ -1753,7 +1758,13 @@
(void) lseek(SHIN, fseekp, L_SET);
}
if (fseekp == feobp) {
@ -52,7 +63,7 @@ diff -u tcsh-6.14.00/sh.lex.c tcsh-6.14.00/sh.lex.c
do
c = wide_read(SHIN, fbuf[0], BUFSIZE, 1);
while (c < 0 && errno == EINTR);
@@ -1926,9 +1934,9 @@
@@ -1926,9 +1937,9 @@
return;
case TCSH_F_SEEK:
#ifdef WIDE_STRINGS

View File

@ -3,7 +3,7 @@
Summary: An enhanced version of csh, the C shell.
Name: tcsh
Version: 6.14
Release: 11
Release: 12
License: distributable
Group: System Environment/Shells
Source: ftp://ftp.astron.com/pub/tcsh/tcsh-%{version}.00.tar.gz
@ -112,6 +112,9 @@ fi
%{_mandir}/*/*
%changelog
* Tue Sep 26 2006 Miloslav Trmac <mitr@redhat.com> - 6.14-12
- Fix error handling in tcsh-6.14.00-wide-seeks.patch
* Sat Sep 9 2006 Miloslav Trmac <mitr@redhat.com> - 6.14-11
- Fix an unlikely crash on startup (#188279)