nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] segfault when writing a file to a path that doesnt exis


From: David Lawrence Ramsey
Subject: Re: [Nano-devel] segfault when writing a file to a path that doesnt exist
Date: Fri, 15 Dec 2006 01:01:00 -0500
User-agent: Thunderbird 1.5.0.8 (X11/20061025)

David Lawrence Ramsey wrote:
> Mike Frysinger wrote:
>
> > noticed with nano-2.0.1 and just reproduced with cvs ...
> >
> > to make it crash, do:
> > nano /some/dir/path/that/does/not/exist
> > hit CTRL+O to save and then just hit enter
>
> Fixed in CVS.  Thanks for the report.

Update: I've attached a patch to fix it in 2.0.1.

diff -ur nano-2.0.1/src/files.c nano-2.0.1-fixed/src/files.c
--- nano-2.0.1/src/files.c      2006-11-09 21:47:11.000000000 -0500
+++ nano-2.0.1-fixed/src/files.c        2006-12-15 00:57:10.000000000 -0500
@@ -1871,8 +1871,9 @@
            if (append == OVERWRITE) {
                char *full_answer = get_full_path(answer);
                char *full_filename = get_full_path(openfile->filename);
-               bool different_name = (strcmp(full_answer,
-                       full_filename) != 0);
+               bool different_name = (strcmp((full_answer == NULL) ?
+                       answer : full_answer, (full_filename == NULL) ?
+                       openfile->filename : full_filename) != 0);
                struct stat st;
                bool name_exists;
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]