Bug#430205: [Patch] Fix errno checking in fileio.c:readfile

James Vega jamessan at debian.org
Sun May 9 21:24:23 UTC 2010


Bram,

In src/fileio.c's readfile function, when the file couldn't be opened,
stat(2) is used to determine why.  The problem being that certain error
conditions are checked in a block that is never reached, thus Vim
incorrectly shows a "[New File]" status message and leaves the buffer
writeable.

The attached patch specifically checks that errno is ENOENT for the
"[New File]"/"[New Directory]" case and moves the other checks inside
the "if (perm < 0)" block.  Now files which the user doesn't have
permission to edit or are too large to edit will be properly flagged as
such and the buffer marked readonly.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: errno.diff
Type: text/x-diff
Size: 4382 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20100509/f323b1b8/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20100509/f323b1b8/attachment.pgp>


More information about the pkg-vim-maintainers mailing list