unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Recent change in filio.c causes crashes
Date: Thu, 28 Jun 2007 10:36:06 -0400	[thread overview]
Message-ID: <jwvejjwb17y.fsf-monnier+emacs@gnu.org> (raw)

The change below causes crashes under my Debian testing version of
GNU/Linux, where glibc complains about double-free in fclose.

The commit log only mentions the docstring change, but not the code change,
so I presume the code change was a simple oversight (the stream is already
properly closed from an unwind handler), but I'd rather have your opinion
before reverting it.


        Stefan


revision 1.582
date: 2007-06-27 19:30:02 -0400;  author: rms;  state: Exp;  lines: +5 -2;  commitid: bXZP137DmjaWIBns;
(syms_of_fileio) <after-insert-file-functions>: Doc fix.
----------------------------


Index: src/fileio.c
===================================================================
RCS file: /sources/emacs/emacs/src/fileio.c,v
retrieving revision 1.581
retrieving revision 1.582
diff -u -r1.581 -r1.582
--- src/fileio.c	8 Jun 2007 20:12:52 -0000	1.581
+++ src/fileio.c	27 Jun 2007 23:30:02 -0000	1.582
@@ -6021,6 +6021,8 @@
 
   /* Prevent another auto save till enough input events come in.  */
   record_auto_save ();
+  if (stream != NULL)
+    fclose (stream);
 
   if (auto_saved && NILP (no_message))
     {
@@ -6683,8 +6685,9 @@
 
   DEFVAR_LISP ("after-insert-file-functions", &Vafter_insert_file_functions,
 	       doc: /* A list of functions to be called at the end of `insert-file-contents'.
-Each is passed one argument, the number of characters inserted.
-It should return the new character count, and leave point the same.
+Each is passed one argument, the number of characters inserted,
+with point at the start of the inserted text.  Each function
+should leave point the same, and return the new character count.
 If `insert-file-contents' is intercepted by a handler from
 `file-name-handler-alist', that handler is responsible for calling the
 functions in `after-insert-file-functions' if appropriate.  */);

             reply	other threads:[~2007-06-28 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-28 14:36 Stefan Monnier [this message]
2007-06-28 19:26 ` Recent change in filio.c causes crashes Richard Stallman
2007-06-28 20:19   ` Stefan Monnier
2007-06-29  5:10     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvejjwb17y.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).