[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] Patch to files.c:read_file
From: |
David Benbennick |
Subject: |
[Nano-devel] Patch to files.c:read_file |
Date: |
Tue, 26 Mar 2002 03:14:38 -0500 (EST) |
Using any version of nano with files.c,v 1.155 and any compile options,
opening a 0-byte file causes a seg fault. Specifically, do
rm somefile
touch somefile
nano somefile
<Type anything>
Attached is a patch fixing that problem.
On Thu, 21 Mar 2002, Chris Allegretta wrote: <snip>
> In all versions of nano, attempting to insert a file of 0 bytes would
> cause nano to go into an infinite loop ...
In fixing the seg fault above, I restored the infinite loop problem, and
spent hours fixing it. Thus, the patch above also has two "assert"
statements added to nano.c. The asserts guard against that loop, which
happened in nano.c:renumber_all.
That takes me to a final point. The assert statement is not tested if
NDEBUG is defined. Most users probably should not have asserts, since
they test impossible conditions. Thus, maybe we should add a line like
AC_DEFINE(NDEBUG)
to configure.ac. (I haven't tested this since I don't have autoconf
2.52.)
David
26mar02:37.diff
Description: Text document
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., (continued)
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Dwayne Rightler, 2002/03/10
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Dwayne Rightler, 2002/03/11
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Chris Allegretta, 2002/03/21
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Dwayne Rightler, 2002/03/21
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Dwayne Rightler, 2002/03/21
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Chris Allegretta, 2002/03/21
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Dwayne Rightler, 2002/03/21
- Re: [Nano-devel] Patch to execute external command and inerst output into buffer..., Jordi Mallach, 2002/03/21
- [Nano-devel] Patch to do_justify, David Benbennick, 2002/03/21
- Re: [Nano-devel] Patch to do_justify, Chris Allegretta, 2002/03/21
- [Nano-devel] Patch to files.c:read_file,
David Benbennick <=
- [Nano-devel] Patch to files.c, David Benbennick, 2002/03/26
- Re: [Nano-devel] Patch to files.c, Chris Allegretta, 2002/03/26
- Re: [Nano-devel] Patch to files.c, David Benbennick, 2002/03/27
- Re: [Nano-devel] Patch to files.c, Chris Allegretta, 2002/03/27
- Re: [Nano-devel] Patch to files.c, David Benbennick, 2002/03/27
- Re: [Nano-devel] Patch to files.c, Chris Allegretta, 2002/03/29