mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
Disable encoding scanning on non-seekable file ports.
* libguile/read.c (scm_i_scan_for_encoding): Don't attempt to scan non-seekable file ports.
This commit is contained in:
parent
2858deaf47
commit
49bb5bd307
1 changed files with 8 additions and 1 deletions
|
@ -42,6 +42,7 @@
|
||||||
#include "libguile/hashtab.h"
|
#include "libguile/hashtab.h"
|
||||||
#include "libguile/hash.h"
|
#include "libguile/hash.h"
|
||||||
#include "libguile/ports.h"
|
#include "libguile/ports.h"
|
||||||
|
#include "libguile/fports.h"
|
||||||
#include "libguile/root.h"
|
#include "libguile/root.h"
|
||||||
#include "libguile/strings.h"
|
#include "libguile/strings.h"
|
||||||
#include "libguile/strports.h"
|
#include "libguile/strports.h"
|
||||||
|
@ -1476,7 +1477,13 @@ scm_i_scan_for_encoding (SCM port)
|
||||||
int i;
|
int i;
|
||||||
int in_comment;
|
int in_comment;
|
||||||
|
|
||||||
|
if (SCM_FPORTP (port) && !SCM_FDES_RANDOM_P (SCM_FPORT_FDES (port)))
|
||||||
|
/* PORT is a non-seekable file port (e.g., as created by Bash when using
|
||||||
|
"guile <(echo '(display "hello")')") so bail out. */
|
||||||
|
return NULL;
|
||||||
|
|
||||||
bytes_read = scm_c_read (port, header, SCM_ENCODING_SEARCH_SIZE);
|
bytes_read = scm_c_read (port, header, SCM_ENCODING_SEARCH_SIZE);
|
||||||
|
|
||||||
scm_seek (port, scm_from_int (0), scm_from_int (SEEK_SET));
|
scm_seek (port, scm_from_int (0), scm_from_int (SEEK_SET));
|
||||||
|
|
||||||
if (bytes_read > 3
|
if (bytes_read > 3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue