From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Recent change in filio.c causes crashes Date: Thu, 28 Jun 2007 10:36:06 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1183041377 19680 80.91.229.12 (28 Jun 2007 14:36:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 28 Jun 2007 14:36:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 28 16:36:16 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I3v6V-0006T0-HH for ged-emacs-devel@m.gmane.org; Thu, 28 Jun 2007 16:36:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I3v6U-0001r3-RD for ged-emacs-devel@m.gmane.org; Thu, 28 Jun 2007 10:36:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I3v6S-0001qf-00 for emacs-devel@gnu.org; Thu, 28 Jun 2007 10:36:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I3v6R-0001qQ-LP for emacs-devel@gnu.org; Thu, 28 Jun 2007 10:36:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I3v6R-0001qL-EK for emacs-devel@gnu.org; Thu, 28 Jun 2007 10:36:11 -0400 Original-Received: from tomts10.bellnexxia.net ([209.226.175.54] helo=tomts10-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I3v6Q-0007a3-5Y; Thu, 28 Jun 2007 10:36:10 -0400 Original-Received: from pastel.home ([70.55.147.252]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070628143606.EBE9197.tomts10-srv.bellnexxia.net@pastel.home>; Thu, 28 Jun 2007 10:36:06 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 9B1A77EDB; Thu, 28 Jun 2007 10:36:06 -0400 (EDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:73999 Archived-At: 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) : 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. */);