[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Using nano as your crontab editor
From: |
David Lawrence Ramsey |
Subject: |
Re: [Nano-devel] Using nano as your crontab editor |
Date: |
Tue, 04 Apr 2006 23:24:19 -0400 |
User-agent: |
Thunderbird 1.5 (X11/20051201) |
Jordi Mallach wrote:
> Hi!
>
> Have a look at this:
> https://launchpad.net/distros/ubuntu/+source/nano/+bug/29732
>
> I have confirmed this behaviour. What's puzzling is the broken
> encoding error message that you get.
The error message itself is normal, since you can't write a backup to
/var/spool/cron/whatever if you're not root. The garbled filename is
due to trying to display the string backupname in the error message
after it's been freed. The attached patch should fix it. It's against
CVS, but applies cleanly to 1.3.11 as well, and applies to 1.3.10 with
only a 3-line offset.
diff -ur nano/src/files.c nano-fixed/src/files.c
--- nano/src/files.c 2006-02-24 14:38:20.000000000 -0500
+++ nano-fixed/src/files.c 2006-04-04 23:00:02.000000000 -0400
@@ -1414,7 +1414,6 @@
openfile->current_stat->st_uid,
openfile->current_stat->st_gid) == -1 ||
utime(backupname, &filetime) == -1) {
- free(backupname);
if (copy_status == -1) {
statusbar(_("Error reading %s: %s"), realname,
strerror(errno));
@@ -1422,6 +1421,7 @@
} else
statusbar(_("Error writing %s: %s"), backupname,
strerror(errno));
+ free(backupname);
goto cleanup_and_exit;
}