#include "libguile/hashtab.h"
#include "libguile/hash.h"
#include "libguile/ports.h"
+#include "libguile/fports.h"
#include "libguile/root.h"
#include "libguile/strings.h"
#include "libguile/strports.h"
int i;
int in_comment;
- bytes_read = scm_c_read (port, header, SCM_ENCODING_SEARCH_SIZE);
+ 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);
+
scm_seek (port, scm_from_int (0), scm_from_int (SEEK_SET));
if (bytes_read > 3