|
From: | Rishabh Dave |
Subject: | Re: [Nano-devel] Patch for bug #44950 |
Date: | Tue, 29 Dec 2015 22:09:40 +0530 |
This is because I run with 'export MALLOC_CHECK_=2'.
So... something is going wrong with your memory allocations.
When you do 'x = charalloc(sizeof(a))', I think you want to do
'x = charalloc(strlen(a) * sizeof(char))'.
Also, you've added a function called strcpyfu(a, b, c, d) that
does the equivalent of strncpy(a, b+c, d-c). Why not use the
latter? Furthermore, you only ever call strcpyfu() with c=0,
so it is in fact identical to strncpy(). :| (Apart from the
zero termination, but the main routine does that anyhow, so...)
The comment of the determine() routine mentions values of
-1 and -2, but the code only ever returns values of zero or
higher. So... I don't know what was the intention there.
After making the above mentioned changes to your patch,
and adjusting it for whitespace too, it no longer aborts
when I use MALLOC_CHECK_=2 with 'src/nano doc/what'.
However, it still does not do the expected thing when giving
it a nonexistent dir: 'src/nano none/what' still tries to write
a lockfile into 'none/' -- it should not, it should just mention
on the statusbar that 'none' does not exist and skip trying
to write a lockfile.
standalone-program-for-patch.c
Description: Text Data
before-and-after-applying-patch-to-nano.png
Description: PNG image
[Prev in Thread] | Current Thread | [Next in Thread] |