diff options
author | Steve Price <steve@FreeBSD.org> | 1999-12-31 20:32:38 +0000 |
---|---|---|
committer | Steve Price <steve@FreeBSD.org> | 1999-12-31 20:32:38 +0000 |
commit | a0ecd6930adbbbf1a805a0f9f7e6cb4405505bdb (patch) | |
tree | 05a2fc68811d315afe552df944627a4ba5e57788 /editors/joe2 | |
parent | 2695ee932aafc105fdd75eaa356fd39315e637aa (diff) | |
download | ports-a0ecd6930adbbbf1a805a0f9f7e6cb4405505bdb.tar.gz ports-a0ecd6930adbbbf1a805a0f9f7e6cb4405505bdb.zip |
Don't coredump when reading in a new file using ^K-R.
PR: 15741
Submitted by: Sergey N. Voronkov <serg@dor.zaural.ru>
Reviewed by: maintainer
Notes
Notes:
svn path=/head/; revision=24319
Diffstat (limited to 'editors/joe2')
-rw-r--r-- | editors/joe2/files/patch-ad | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/editors/joe2/files/patch-ad b/editors/joe2/files/patch-ad index 258c8c2c2a31..a57f81ee61e2 100644 --- a/editors/joe2/files/patch-ad +++ b/editors/joe2/files/patch-ad @@ -1,5 +1,5 @@ ---- b.c.orig Fri Jan 20 09:38:25 1995 -+++ b.c Tue Dec 7 13:35:11 1999 +--- b.c.orig Fri Jan 20 13:38:25 1995 ++++ b.c Tue Dec 28 15:56:10 1999 @@ -22,4 +22,7 @@ #endif #include <errno.h> @@ -23,12 +23,14 @@ + } if(b->changed) abrerr(b->name); if(b==errbuf) errbuf=0; -@@ -1672,4 +1680,5 @@ +@@ -1672,5 +1680,6 @@ long skip,amnt; char *n; +- int nowrite=0; + struct stat sb; - int nowrite=0; ++ int nowrite=0,fh=-1; + if(!s || !s[0]) @@ -1705,4 +1714,26 @@ fi=fopen(n,"r"); if(!fi) nowrite=0; @@ -46,8 +48,8 @@ + already locked, */ + + if ((fi) && (!nowrite)) { -+ b->filehandle = dup (fileno (fi)); -+ nowrite = (flock (b->filehandle, LOCK_EX | LOCK_NB)); ++ fh = dup( fileno(fi) ); ++ nowrite = (flock (fh, LOCK_EX | LOCK_NB)); + } +/*printf ("nowrite flock=%i\n", nowrite); */ + @@ -56,3 +58,9 @@ + } joesep(n); +@@ -1762,4 +1793,5 @@ + + b->er=error; ++ if( fh != -1 ) b->filehandle = fh; + return b; + } |