summaryrefslogtreecommitdiffstats
path: root/editors/joe2
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1999-12-31 20:32:38 +0000
committersteve <steve@FreeBSD.org>1999-12-31 20:32:38 +0000
commit77211da487469cf0a4c7ac2603f41d7df3f761bd (patch)
tree5f7e8de10a5bddea63e15a95d8a229bf601d42dd /editors/joe2
parent0085fe865871079b1ee5c42ac0949eb8479d0d4b (diff)
downloadFreeBSD-ports-77211da487469cf0a4c7ac2603f41d7df3f761bd.zip
FreeBSD-ports-77211da487469cf0a4c7ac2603f41d7df3f761bd.tar.gz
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
Diffstat (limited to 'editors/joe2')
-rw-r--r--editors/joe2/files/patch-ad20
1 files changed, 14 insertions, 6 deletions
diff --git a/editors/joe2/files/patch-ad b/editors/joe2/files/patch-ad
index 258c8c2..a57f81e 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;
+ }
OpenPOWER on IntegriCloud