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

Bram Moolenaar Bram at Moolenaar.net
Mon May 10 18:15:20 UTC 2010


James -

> 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.

Thanks, I'll add it to the todo list.

- Bram

-- 
Apparently, 1 in 5 people in the world are Chinese.  And there are 5
people in my family, so it must be one of them.  It's either my mum
or my dad.  Or my older brother Colin.  Or my younger brother
Ho-Cha-Chu.  But I think it's Colin.

 /// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///





More information about the pkg-vim-maintainers mailing list