mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
* fports.c (scm_stdio_to_port, scm_open_file): Set the port's
pointer to the stdio stream before calling scm_setbuf0, so the latter will be able to retrieve it. I'm surprised this didn't segfault earlier. (Thanks to Christopher Lee.)
This commit is contained in:
parent
3594582bd1
commit
7471fb031f
1 changed files with 2 additions and 2 deletions
|
@ -171,9 +171,9 @@ scm_open_file (filename, modes)
|
||||||
pt = scm_add_to_port_table (port);
|
pt = scm_add_to_port_table (port);
|
||||||
SCM_SETPTAB_ENTRY (port, pt);
|
SCM_SETPTAB_ENTRY (port, pt);
|
||||||
SCM_SETCAR (port, scm_tc16_fport | scm_mode_bits (mode));
|
SCM_SETCAR (port, scm_tc16_fport | scm_mode_bits (mode));
|
||||||
|
SCM_SETSTREAM (port, (SCM) f);
|
||||||
if (SCM_BUF0 & SCM_CAR (port))
|
if (SCM_BUF0 & SCM_CAR (port))
|
||||||
scm_setbuf0 (port);
|
scm_setbuf0 (port);
|
||||||
SCM_SETSTREAM (port, (SCM) f);
|
|
||||||
SCM_PTAB_ENTRY (port)->file_name = filename;
|
SCM_PTAB_ENTRY (port)->file_name = filename;
|
||||||
}
|
}
|
||||||
SCM_ALLOW_INTS;
|
SCM_ALLOW_INTS;
|
||||||
|
@ -205,9 +205,9 @@ scm_stdio_to_port (file, mode, name)
|
||||||
pt = scm_add_to_port_table (port);
|
pt = scm_add_to_port_table (port);
|
||||||
SCM_SETPTAB_ENTRY (port, pt);
|
SCM_SETPTAB_ENTRY (port, pt);
|
||||||
SCM_SETCAR (port, (scm_tc16_fport | mode_bits));
|
SCM_SETCAR (port, (scm_tc16_fport | mode_bits));
|
||||||
|
SCM_SETSTREAM (port, (SCM) file);
|
||||||
if (SCM_BUF0 & SCM_CAR (port))
|
if (SCM_BUF0 & SCM_CAR (port))
|
||||||
scm_setbuf0 (port);
|
scm_setbuf0 (port);
|
||||||
SCM_SETSTREAM (port, (SCM) file);
|
|
||||||
SCM_PTAB_ENTRY (port)->file_name = scm_makfrom0str (name);
|
SCM_PTAB_ENTRY (port)->file_name = scm_makfrom0str (name);
|
||||||
}
|
}
|
||||||
SCM_ALLOW_INTS;
|
SCM_ALLOW_INTS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue