* wrong GCPRO in openp ()
@ 2006-02-06 12:43 Kenichi Handa
2006-02-06 18:49 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Kenichi Handa @ 2006-02-06 12:43 UTC (permalink / raw)
I've just got a bug report about wrong GCPRO in openp ().
The relevant code is this:
openp (path, str, suffixes, storeptr, predicate)
[...]
{
[...]
string = filename = Qnil;
GCPRO6 (str, string, filename, path, suffixes, encoded_fn);
As encoded_fn is not yet initialized here, there's a
possibility that it leads to crash in mark_object. As a
simple fix is to initialized it to Qnil, I've just installed
such a change.
But, the variable encoded_fn is used as this:
[...]
else
{
const char *pfn;
encoded_fn = ENCODE_FILE (string);
pfn = SDATA (encoded_fn);
exists = (stat (pfn, &st) >= 0
&& (st.st_mode & S_IFMT) != S_IFDIR);
if (exists)
{
/* Check that we can access or open it. */
if (NATNUMP (predicate))
fd = (access (pfn, XFASTINT (predicate)) == 0) ? 1 : -1;
else
fd = emacs_open (pfn, O_RDONLY, 0);
[...]
So, I think there's no need of GCPRO for encoded_fn. Eli,
it seems that you are the last one who changed the code
around here.
2002-03-29 Eli Zaretskii <eliz@is.elta.co.il>
[...]
* lread.c (openp, Fload): Encode the file name before passing it
to `stat', `access', and `emacs_open'.
(openp): GCPRO the encoded file name. Don't recompute Lisp
strings unnecessarily.
Do you remember why you did this change?
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: wrong GCPRO in openp ()
2006-02-06 12:43 wrong GCPRO in openp () Kenichi Handa
@ 2006-02-06 18:49 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2006-02-06 18:49 UTC (permalink / raw)
Cc: emacs-devel
> From: Kenichi Handa <handa@m17n.org>
> Date: Mon, 06 Feb 2006 21:43:04 +0900
>
> But, the variable encoded_fn is used as this:
>
> [...]
> else
> {
> const char *pfn;
>
> encoded_fn = ENCODE_FILE (string);
> pfn = SDATA (encoded_fn);
> exists = (stat (pfn, &st) >= 0
> && (st.st_mode & S_IFMT) != S_IFDIR);
> if (exists)
> {
> /* Check that we can access or open it. */
> if (NATNUMP (predicate))
> fd = (access (pfn, XFASTINT (predicate)) == 0) ? 1 : -1;
> else
> fd = emacs_open (pfn, O_RDONLY, 0);
> [...]
>
> So, I think there's no need of GCPRO for encoded_fn. Eli,
> it seems that you are the last one who changed the code
> around here.
>
> 2002-03-29 Eli Zaretskii <eliz@is.elta.co.il>
> [...]
> * lread.c (openp, Fload): Encode the file name before passing it
> to `stat', `access', and `emacs_open'.
> (openp): GCPRO the encoded file name. Don't recompute Lisp
> strings unnecessarily.
>
> Do you remember why you did this change?
Sorry, no. Most probably because Richard (or someone else) asked me
to, but that's a guess.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-06 18:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-06 12:43 wrong GCPRO in openp () Kenichi Handa
2006-02-06 18:49 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).