Don't open zero byte sized files read-only (e.g. files in /proc).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2307 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
b7f834dbc0
commit
076066c7db
@ -4,6 +4,8 @@
|
||||
Apply patch from Yura Siamashka to use she-bang filetype detection
|
||||
also in filetypes_detect_from_filename() which let plugins benefit
|
||||
from this feature.
|
||||
* src/document.c:
|
||||
Don't open zero byte sized files read-only (e.g. files in /proc).
|
||||
|
||||
|
||||
2008-03-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
@ -842,7 +842,9 @@ static gboolean load_text_file(const gchar *locale_filename, const gchar *utf8_f
|
||||
tmp_enc_idx = encodings_scan_unicode_bom(filedata->data, filedata->size, NULL);
|
||||
|
||||
/* check whether the size of the loaded data is equal to the size of the file in the filesystem */
|
||||
if (filedata->len != filedata->size && (
|
||||
/* file size may be 0 to allow opening files in /proc/ which have typically a file size
|
||||
* of 0 bytes */
|
||||
if (filedata->len != filedata->size && filedata->size != 0 && (
|
||||
tmp_enc_idx == GEANY_ENCODING_UTF_8 || /* tmp_enc_idx can be UTF-7/8/16/32, UCS and None */
|
||||
tmp_enc_idx == GEANY_ENCODING_UTF_7 || /* filter out UTF-7/8 and None where no NULL bytes */
|
||||
tmp_enc_idx == GEANY_ENCODING_NONE)) /* are allowed */
|
||||
|
Loading…
x
Reference in New Issue
Block a user